Browse Source

Add a test UI

pull/4/head
liangshiwei 5 years ago
parent
commit
e3d491e326
  1. 13
      README.md
  2. BIN
      img/left1.png
  3. BIN
      img/left2.png
  4. BIN
      img/top1.png
  5. BIN
      img/top2.png
  6. 2
      modules/Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme/Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme.csproj
  7. 2
      modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/AbpAntDesignThemeOptions.cs
  8. 66
      modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Layout/AbpPageHeader.razor
  9. 6
      modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Layout/PageLayout.cs
  10. 19
      modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/Branding.razor
  11. 9
      modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/Branding.razor.cs
  12. 56
      modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/DefaultLayout.razor
  13. 2
      modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/MainMenu.razor
  14. 3
      modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/MainMenu.razor.cs
  15. 6
      modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/MainMenuItem.razor
  16. 4
      modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/NavToolbar.razor
  17. 53
      modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/NavToolbar.razor.cs
  18. 111
      modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/wwwroot/libs/abp/css/theme.css
  19. 15
      modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/AbpAspNetCoreComponentsWebAssemblyAntDesignThemeModule.cs
  20. 28
      modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/AntDesignThemeToolbarContributor.cs
  21. 2
      modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/ComponentsComponentsBundleContributor.cs
  22. 13
      modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.csproj
  23. 7
      modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/Pages/Authentication.razor
  24. 79
      modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/Themes/AntDesignTheme/LanguageSwitch.razor
  25. 46
      modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/Themes/AntDesignTheme/LoginDisplay.razor
  26. 76
      modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/Themes/AntDesignTheme/LoginDisplay.razor.cs
  27. 2
      modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/Themes/AntDesignTheme/_Imports.razor
  28. 2
      src/Lsw.Abp.AntDesignUI/AntDesignUiNotificationService.cs
  29. 4
      src/Lsw.Abp.AntDesignUI/Components/EntityAction.razor.cs
  30. 4
      src/Lsw.Abp.AntDesignUI/Components/PageAlert.razor
  31. 2
      src/Lsw.Abp.AntDesignUI/Components/ToolbarButton.razor
  32. 29
      src/Lsw.Abp.AntDesignUI/Components/UiPageProgress.razor
  33. 35
      src/Lsw.Abp.AntDesignUI/Components/UiPageProgress.razor.cs
  34. 9
      src/Lsw.Abp.AntDesignUI/_Imports.razor
  35. 12
      test/AntDesignUIApp/AntDesignAppBrandBrandingProvider.cs
  36. 36
      test/AntDesignUIApp/AntDesignUIAppMenuContributor.cs
  37. 7
      test/AntDesignUIApp/AntDesignUIAppModule.cs
  38. 6
      test/AntDesignUIApp/FakeAbpApplicationConfigurationAppService.cs
  39. 7
      test/AntDesignUIApp/Pages/Index.razor
  40. 26
      test/AntDesignUIApp/Pages/Index.razor.cs
  41. 6
      test/AntDesignUIApp/Pages/Roles.razor
  42. 18
      test/AntDesignUIApp/Pages/Roles.razor.cs
  43. 6
      test/AntDesignUIApp/Pages/Users.razor
  44. 18
      test/AntDesignUIApp/Pages/Users.razor.cs
  45. 126
      test/AntDesignUIApp/wwwroot/global.css
  46. 4
      test/AntDesignUIApp/wwwroot/index.html
  47. 43
      test/AntDesignUIApp/wwwroot/logo.svg

13
README.md

@ -1,2 +1,13 @@
# Lsw.Abp.AntDesignUI
## Still in progress!
An Abp Blazor Theme based [Ant-Design-Blazor](https://github.com/ant-design-blazor/ant-design-blazor)
![left1](img/left1.png)
![left2](img/left2.png)
![top1](img/top1.png)
![top2](img/top2.png)

BIN
img/left1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
img/left2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
img/top1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

BIN
img/top2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

2
modules/Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme/Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme.csproj

@ -17,7 +17,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Themes\AntDesign" />
<Folder Include="Themes\AntDesignTheme" />
</ItemGroup>
</Project>

2
modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/AbpAntDesignThemeOptions.cs

@ -21,7 +21,7 @@ public class MenuOptions
public MenuOptions()
{
Theme = MenuTheme.Light;
Place = MenuPlace.Top;
Place = MenuPlace.Left;
}
public MenuMode GetMode()

66
modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Layout/AbpPageHeader.razor

@ -1,50 +1,50 @@
@using Microsoft.Extensions.Options
@inject IOptions<PageHeaderOptions> Options
<Row Style="margin-left: 15px">
<Breadcrumb>
@if (Options.Value.RenderPageTitle)
{
<b>@PageLayout.Title</b>
}
@if (Options.Value.RenderBreadcrumbs && PageLayout.BreadcrumbItems.Any())
{
@if (BreadcrumbShowHome)
<Row Class="ant-design-row-breadcrumb">
<Col Span="12">
<Breadcrumb Class="ant-design-breadcrumb">
@if (Options.Value.RenderBreadcrumbs && PageLayout.BreadcrumbItems.Any())
{
<BreadcrumbItem Href="">
<Icon Type="home"/>
</BreadcrumbItem>
}
@foreach (var item in PageLayout.BreadcrumbItems)
{
<BreadcrumbItem Href="@item.Url">
@if (!item.Icon.IsNullOrWhiteSpace())
{
<Icon Type="@item.Icon"/>
}
@item.Text
</BreadcrumbItem>
@if (BreadcrumbShowHome)
{
<BreadcrumbItem Href="">
<Icon Type="home"/>
</BreadcrumbItem>
}
@foreach (var item in PageLayout.BreadcrumbItems)
{
<BreadcrumbItem Href="@item.Url">
@if (!item.Icon.IsNullOrWhiteSpace())
{
<Icon Type="@item.Icon"/>
}
@item.Text
</BreadcrumbItem>
}
}
}
</Breadcrumb>
@if (Options.Value.RenderToolbar)
{
<div>
</Breadcrumb>
</Col>
<Col Span="12">
@if (Options.Value.RenderToolbar)
{
<Row justify="end">
@if (Toolbar == null)
{
@ChildContent
}
@foreach (var toolbarItemRender in ToolbarItemRenders)
{
<div class="px-1 pt-2">
<div style="margin: 0 5px">
@toolbarItemRender
</div>
}
</Row>
</div>
}
}
</Col>
</Row>
@if (Options.Value.RenderPageTitle)
{
<div class="ant-design-page-title">@PageLayout.Title</div>
}

6
modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Layout/PageLayout.cs

@ -8,15 +8,15 @@ namespace Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme.Layout;
public class PageLayout : IScopedDependency, INotifyPropertyChanged
{
private string title;
private string _title;
// TODO: Consider using this property for setting Page Title too.
public virtual string Title
{
get => title;
get => _title;
set
{
title = value;
_title = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Title)));
}
}

19
modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/Branding.razor

@ -1,10 +1,15 @@
@using Volo.Abp.Ui.Branding
@inject IBrandingProvider BrandingProvider
<div class="ant-design-brand">
<a href="">
@if (!BrandingProvider.LogoUrl.IsNullOrWhiteSpace())
{
<img src="@BrandingProvider.LogoUrl.TrimStart('/','~')" alt="@BrandingProvider.AppName"/>
}
@if (!Collapsed)
{
<h1>@BrandingProvider.AppName</h1>
}
</a>
</div>
<a class="ant-design-brand" href="">
@if (!BrandingProvider.LogoUrl.IsNullOrWhiteSpace())
{
<img src="@BrandingProvider.LogoUrl.TrimStart('/','~')" alt="@BrandingProvider.AppName"/>
}
@BrandingProvider.AppName
</a>

9
modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/Branding.razor.cs

@ -0,0 +1,9 @@
using Microsoft.AspNetCore.Components;
namespace Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme.Themes.AntDesignTheme;
public partial class Branding
{
[Parameter]
public bool Collapsed { get; set; }
}

56
modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/DefaultLayout.razor

@ -2,45 +2,69 @@
@using Microsoft.Extensions.Options
@inject IOptions<AbpAntDesignThemeOptions> Options
@{
var sideTheme = Options.Value.Menu.Theme == MenuTheme.Light ? SiderTheme.Light : SiderTheme.Dark;
var light = Options.Value.Menu.Theme == MenuTheme.Light;
}
@if (Options.Value.Menu.Place == MenuOptions.MenuPlace.Top)
{
var headerTopClass = light ? "ant-design-header-top ant-design-header-top-light" : "ant-design-header-top";
<Layout Class="ant-design-layout">
<Header Class="ant-design-header">
<Header Class="@headerTopClass">
<Branding/>
<MainMenu/>
<MainMenu Collapsed="@Collapsed"/>
<Row Justify="end">
<NavToolbar/>
</Row>
</Header>
<Content Class="ant-design-content">
<PageAlert/>
@Body
<div class="ant-design-body-content">
@Body
</div>
<UiPageProgress/>
</Content>
<Footer Class="ant-design-footer">Footer</Footer>
<Footer Class="ant-design-footer"></Footer>
</Layout>
}
else
{
var headerLeftClass = light ? "ant-design-header-left ant-design-header-left-light" : "ant-design-header-left";
<Layout Class="ant-design-layout">
<Sider
Class="ant-design-side"
Theme="@sideTheme"
Collapsible
NoTrigger
Collapsed=Collapsed>
<Branding/>
<MainMenu/>
<Branding Collapsed="@Collapsed"/>
<MainMenu Collapsed="@Collapsed"/>
</Sider>
<Layout Class="ant-design-layout">
<Header Class="ant-design-header">
@if (Collapsed)
{
<Icon Type="menu-unfold" Theme="outline" Class="trigger" OnClick="OnCollapse" />
}
else
{
<Icon Type="menu-fold" Theme="outline" Class="trigger" OnClick="OnCollapse" />
}
<Header Class="@headerLeftClass">
<div style="float: left">
@if (Collapsed)
{
<Icon Type="menu-unfold" Theme="outline" Class="trigger" OnClick="OnCollapse"/>
}
else
{
<Icon Type="menu-fold" Theme="outline" Class="trigger" OnClick="OnCollapse"/>
}
</div>
<Row Justify="end">
<NavToolbar/>
</Row>
</Header>
<Content Class="ant-design-content">
<PageAlert/>
@Body
<div class="ant-design-body-content">
@Body
</div>
<UiPageProgress/>
</Content>
<Footer Class="ant-design-footer"></Footer>

2
modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/MainMenu.razor

@ -1,4 +1,4 @@
<Menu Mode="@Options.Value.Menu.GetMode()" Theme="@Options.Value.Menu.Theme">
<Menu Mode="@Options.Value.Menu.GetMode()" Theme="@Options.Value.Menu.Theme" InlineCollapsed="@Collapsed">
@if (Menu != null)
{
foreach (var menu in Menu.Items)

3
modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/MainMenu.razor.cs

@ -19,6 +19,9 @@ public partial class MainMenu : IDisposable
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
[Parameter]
public bool Collapsed { get; set; }
protected override async Task OnInitializedAsync()
{

6
modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/MainMenuItem.razor

@ -7,17 +7,17 @@
if (Menu.IsLeaf && Menu.Url != null)
{
<MenuItem Id="@elementId" RouterLink="@url" Disabled="@Menu.IsDisabled">
<MenuItem Key="@elementId" RouterLink="@url" Disabled="@Menu.IsDisabled">
@if (Menu.Icon != null)
{
<Icon Type="@Menu.Icon" Theme="outline"></Icon>
}
@Menu.Name
<span>@Menu.Name</span>
</MenuItem>
}
else
{
<SubMenu Title="@Menu.Name" TitleTemplate="@GetSubMenuTemplate()" Id="elementId">
<SubMenu Title="@Menu.Name" TitleTemplate="@GetSubMenuTemplate()" Key="@elementId">
@foreach (var menuItem in Menu.Items)
{
<MainMenuItem Menu="@menuItem"></MainMenuItem>

4
modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/NavToolbar.razor

@ -0,0 +1,4 @@
@foreach (var render in ToolbarItemRenders)
{
@render
}

53
modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Themes/AntDesignTheme/NavToolbar.razor.cs

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme.Toolbars;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
namespace Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme.Themes.AntDesignTheme;
public partial class NavToolbar: IDisposable
{
[Inject]
private IToolbarManager ToolbarManager { get; set; }
[Inject]
private AuthenticationStateProvider AuthenticationStateProvider { get; set; }
private List<RenderFragment> ToolbarItemRenders { get; set; } = new();
protected override async Task OnInitializedAsync()
{
await GetToolbarItemRendersAsync();
AuthenticationStateProvider.AuthenticationStateChanged += AuthenticationStateProviderOnAuthenticationStateChanged;
}
private async Task GetToolbarItemRendersAsync()
{
var toolbar = await ToolbarManager.GetAsync(StandardToolbars.Main);
ToolbarItemRenders.Clear();
var sequence = 0;
foreach (var item in toolbar.Items)
{
ToolbarItemRenders.Add(builder =>
{
builder.OpenComponent(sequence++, item.ComponentType);
builder.CloseComponent();
});
}
}
private async void AuthenticationStateProviderOnAuthenticationStateChanged(Task<AuthenticationState> task)
{
await GetToolbarItemRendersAsync();
await InvokeAsync(StateHasChanged);
}
public void Dispose()
{
AuthenticationStateProvider.AuthenticationStateChanged -= AuthenticationStateProviderOnAuthenticationStateChanged;
}
}

111
modules/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/wwwroot/libs/abp/css/theme.css

@ -6,9 +6,120 @@ body,
app {
height: 100%;
}
.colorWeak {
filter: invert(80%);
}
.ant-layout {
min-height: 100vh;
}
.ant-design-header-top {
background-color: #001529;
}
.ant-design-header-top-light {
background-color: #fff;
}
.ant-design-header-left {
background-color: white;
box-shadow: 0 1px 4px rgb(0 21 41 / 8%)
}
.ant-design-header-left-light {
background-color: #001529;
}
.ant-design-body-content {
margin: 16px 50px;
}
.ant-design-footer {
text-align: center;
}
.page-content {
min-height: 80vh;
background: #fff;
padding: 24px;
margin-top: 8px;
}
.ant-design-page-title {
font-size: 20px;
font-weight: 600;
margin-top: 8px;
}
.ant-design-header-left .trigger {
font-size: 18px;
line-height: 64px;
cursor: pointer;
transition: color 0.3s;
}
.ant-design-header-left .trigger:hover {
color: #1890ff;
}
.ant-design-header-left-light .trigger {
color: white;
}
.ant-design-side .ant-design-brand {
font-size: 15px;
font-weight: 600;
display: flex;
padding: 16px 16px;
cursor: pointer;
}
.ant-design-side .ant-design-brand img {
display: inline-block;
height: 35px
}
.ant-design-side .ant-design-brand h1 {
display: inline-block;
color: white;
margin: 0 0 0 12px;
}
.ant-layout-sider-light .ant-design-brand h1 {
color: #001529;
}
.ant-design-header-top .ant-design-brand img {
display: inline-block;
height: 35px
}
.ant-design-header-top .ant-design-brand {
position: relative;
float: left;
min-width: 170px;
}
.ant-design-header-top .ant-design-brand h1 {
display: inline-block;
color: white;
margin: 0 0 0 12px;
font-weight: 400;
font-size: 15px;
vertical-align: top;
}
.ant-design-header-top-light .ant-design-brand h1 {
color: #001529;
}
.ant-design-header-top .ant-menu-root{
margin-left: 20px;
float: left;
}
.abp-application-layout .ant-menu-sub li{
min-width: 120px;
}

15
modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/AbpAspNetCoreComponentsWebAssemblyAntDesignThemeModule.cs

@ -1,4 +1,6 @@
using Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme;
using Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme.Routing;
using Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme.Toolbars;
using Volo.Abp.AspNetCore.Components.WebAssembly;
using Volo.Abp.Modularity;
@ -10,5 +12,16 @@ namespace Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme;
)]
public class AbpAspNetCoreComponentsWebAssemblyAntDesignThemeModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpRouterOptions>(options =>
{
options.AdditionalAssemblies.Add(typeof(AbpAspNetCoreComponentsWebAssemblyAntDesignThemeModule).Assembly);
});
Configure<AbpToolbarOptions>(options =>
{
options.Contributors.Add(new AntDesignThemeToolbarContributor());
});
}
}

28
modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/AntDesignThemeToolbarContributor.cs

@ -0,0 +1,28 @@
using System.Threading.Tasks;
using Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme.Toolbars;
using Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Themes.AntDesignTheme;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.Extensions.DependencyInjection;
namespace Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme;
public class AntDesignThemeToolbarContributor: IToolbarContributor
{
public Task ConfigureToolbarAsync(IToolbarConfigurationContext context)
{
if (context.Toolbar.Name == StandardToolbars.Main)
{
context.Toolbar.Items.Add(new ToolbarItem(typeof(LanguageSwitch)));
var authenticationStateProvider = context.ServiceProvider
.GetRequiredService<AuthenticationStateProvider>();
if (authenticationStateProvider != null)
{
context.Toolbar.Items.Add(new ToolbarItem(typeof(LoginDisplay)));
}
}
return Task.CompletedTask;
}
}

2
modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/ComponentsComponentsBundleContributor.cs

@ -6,7 +6,7 @@ public class ComponentsComponentsBundleContributor : IBundleContributor
{
public void AddScripts(BundleContext context)
{
//context.Add("_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js");
context.Add("_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js");
context.Add("_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/abp.js");
context.Add("_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/lang-utils.js");
context.Add("_content/AntDesign/js/ant-design-blazor.js");

13
modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.csproj

@ -1,20 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\configureawait.props"/>
<Import Project="..\..\configureawait.props" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme\Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme.csproj"/>
<ProjectReference Include="..\Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme\Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly" Version="5.1.3"/>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.1"/>
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="6.0.1"/>
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0"/>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="6.0.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly" Version="5.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
</ItemGroup>
</Project>

7
modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/Pages/Authentication.razor

@ -0,0 +1,7 @@
@page "/authentication/{action}"
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
<RemoteAuthenticatorView Action="@Action" />
@code{
[Parameter] public string Action { get; set; }
}

79
modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/Themes/AntDesignTheme/LanguageSwitch.razor

@ -0,0 +1,79 @@
@using Volo.Abp.Localization
@using System.Collections.Immutable
@using System.Globalization
@using Microsoft.JSInterop
@inject ILanguageProvider LanguageProvider
@inject IJSRuntime JsRuntime
@if (_otherLanguages != null && _otherLanguages.Any())
{
<Dropdown>
<Overlay>
<Menu>
@foreach (var language in _otherLanguages)
{
<MenuItem OnClick="() => ChangeLanguageAsync(language)">
@language.DisplayName
</MenuItem>
}
</Menu>
</Overlay>
<ChildContent>
<a class="ant-dropdown-link" @onclick:preventDefault>
@_currentLanguage.DisplayName <Icon Type="down" />
</a>
</ChildContent>
</Dropdown>
}
@code {
private IReadOnlyList<LanguageInfo> _otherLanguages;
private LanguageInfo _currentLanguage;
protected override async Task OnInitializedAsync()
{
var selectedLanguageName = await JsRuntime.InvokeAsync<string>(
"localStorage.getItem",
"Abp.SelectedLanguage"
);
_otherLanguages = await LanguageProvider.GetLanguagesAsync();
if (!_otherLanguages.Any())
{
return;
}
if (!selectedLanguageName.IsNullOrWhiteSpace())
{
_currentLanguage = _otherLanguages.FirstOrDefault(l => l.UiCultureName == selectedLanguageName);
}
if (_currentLanguage == null)
{
_currentLanguage = _otherLanguages.FirstOrDefault(l => l.UiCultureName == CultureInfo.CurrentUICulture.Name);
}
if (_currentLanguage == null)
{
_currentLanguage = _otherLanguages.FirstOrDefault();
}
_otherLanguages = _otherLanguages.Where(l => l != _currentLanguage).ToImmutableList();
}
protected virtual async Task ChangeLanguageAsync(LanguageInfo language)
{
await JsRuntime.InvokeVoidAsync(
"localStorage.setItem",
"Abp.SelectedLanguage", language.UiCultureName
);
await JsRuntime.InvokeVoidAsync(
"localStorage.setItem",
"Abp.IsRtl", CultureInfo.GetCultureInfo(language.UiCultureName).TextInfo.IsRightToLeft
);
await JsRuntime.InvokeVoidAsync("location.reload");
}
}

46
modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/Themes/AntDesignTheme/LoginDisplay.razor

@ -0,0 +1,46 @@
@using global::Localization.Resources.AbpUi
@using Microsoft.Extensions.Localization
@* @using Microsoft.AspNetCore.Components.Authorization *@
@using Microsoft.JSInterop
@inherits Volo.Abp.AspNetCore.Components.AbpComponentBase
@inject IJSRuntime JsRuntime
@inject NavigationManager Navigation
@inject IStringLocalizer<AbpUiResource> UiLocalizer
<AuthorizeView>
<Authorized>
<Dropdown>
<Overlay>
<Menu>
@if (Menu != null)
{
@foreach (var menuItem in Menu.Items)
{
<MenuItem OnClick="@(() => NavigateToAsync(menuItem.Url, menuItem.Target))">
@menuItem.DisplayName
</MenuItem>
}
}
<MenuDivider/>
<MenuItem OnClick="BeginSignOut">
@UiLocalizer["Logout"]
</MenuItem>
</Menu>
</Overlay>
<ChildContent>
@* @if (CurrentTenant.Name != null) *@
@* { *@
@* <span><i>@CurrentTenant.Name</i>\@CurrentUser.UserName</span> *@
@* } *@
@* else *@
@* { *@
@* <span>@CurrentUser.UserName</span> *@
@* } *@
@* <Icon Type="down" /> *@
</ChildContent>
</Dropdown>
</Authorized>
<NotAuthorized>
<a class="nav-link" href="authentication/login">@UiLocalizer["Login"]</a>
</NotAuthorized>
</AuthorizeView>

76
modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/Themes/AntDesignTheme/LoginDisplay.razor.cs

@ -0,0 +1,76 @@
using System;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
using Microsoft.JSInterop;
using Volo.Abp.UI.Navigation;
namespace Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Themes.AntDesignTheme;
public partial class LoginDisplay : IDisposable
{
[Inject]
protected IMenuManager MenuManager { get; set; }
[Inject]
public AuthenticationStateProvider AuthenticationStateProvider { get; set; }
[CanBeNull]
protected SignOutSessionStateManager SignOutManager;
protected ApplicationMenu Menu { get; set; }
protected override async Task OnInitializedAsync()
{
Menu = await MenuManager.GetAsync(StandardMenus.User);
Navigation.LocationChanged += OnLocationChanged;
LazyGetService(ref SignOutManager);
AuthenticationStateProvider.AuthenticationStateChanged +=
AuthenticationStateProviderOnAuthenticationStateChanged;
}
protected virtual void OnLocationChanged(object sender, LocationChangedEventArgs e)
{
InvokeAsync(StateHasChanged);
}
private async void AuthenticationStateProviderOnAuthenticationStateChanged(Task<AuthenticationState> task)
{
Menu = await MenuManager.GetAsync(StandardMenus.User);
await InvokeAsync(StateHasChanged);
}
public void Dispose()
{
Navigation.LocationChanged -= OnLocationChanged;
AuthenticationStateProvider.AuthenticationStateChanged -=
AuthenticationStateProviderOnAuthenticationStateChanged;
}
private async Task NavigateToAsync(string uri, string target = null)
{
if (target == "_blank")
{
await JsRuntime.InvokeVoidAsync("open", uri, target);
}
else
{
Navigation.NavigateTo(uri);
}
}
private async Task BeginSignOut()
{
if (SignOutManager != null)
{
await SignOutManager.SetSignOutState();
await NavigateToAsync("authentication/logout");
}
}
}

2
modules/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme/Themes/AntDesignTheme/_Imports.razor

@ -0,0 +1,2 @@
@using Microsoft.AspNetCore.Components.Web
@using AntDesign

2
src/Lsw.Abp.AntDesignUI/AntDesignUiNotificationService.cs

@ -13,7 +13,7 @@ namespace Lsw.Abp.AntDesignUI;
public class AntDesignUiNotificationService: IUiNotificationService, IScopedDependency
{
[Inject]
protected NotificationService NoticeService { get; set; }
public NotificationService NoticeService { get; set; }
private readonly IStringLocalizer<AbpUiResource> _localizer;

4
src/Lsw.Abp.AntDesignUI/Components/EntityAction.razor.cs

@ -42,10 +42,10 @@ public partial class EntityAction<TItem> : ComponentBase
public EntityActions<TItem> ParentActions { get; set; }
[Inject]
protected IAuthorizationService AuthorizationService { get; set; }
public IAuthorizationService AuthorizationService { get; set; }
[Inject]
protected IUiMessageService UiMessageService { get; set; }
public IUiMessageService UiMessageService { get; set; }
protected override async Task OnInitializedAsync()
{

4
src/Lsw.Abp.AntDesignUI/Components/PageAlert.razor

@ -16,10 +16,10 @@
private readonly List<AlertMessage> _messages = new();
[Inject]
protected IAlertManager AlertManager { get; set; }
public IAlertManager AlertManager { get; set; }
[Inject]
protected NavigationManager NavigationManager { get; set; }
public NavigationManager NavigationManager { get; set; }
protected override void OnInitialized()
{

2
src/Lsw.Abp.AntDesignUI/Components/ToolbarButton.razor

@ -1,4 +1,4 @@
<Button Type="@Color" onclick="@Clicked" Disabled="@Disabled">
<Button Type="@Color" OnClick="@Clicked" Disabled="@Disabled">
@if (Icon != null)
{
<Icon Type="@Icon" Class="me-1"></Icon>

29
src/Lsw.Abp.AntDesignUI/Components/UiPageProgress.razor

@ -1,16 +1,14 @@
@if (_percent is >= 0 and <= 100)
{
<div Class="uiPageProgress">
if (_progressStatus == ProgressStatus.Active)
{
<Progress StrokeColor="_gradients" Percent=_percent.Value></Progress>
}
else
{
<Progress Percent=_percent.Value></Progress>
}
</div>
}
<div Class="@_css">
@if (_progressStatus == ProgressStatus.Active)
{
<Progress Status="_progressStatus" StrokeColor="_gradients" Percent="@_percent" ShowInfo="false"></Progress>
}
else
{
<Progress Status="_progressStatus" ShowInfo="false" Percent=@_percent></Progress>
}
</div>
<style>
.uiPageProgress{
@ -19,5 +17,10 @@
width: 100% !important;
z-index: 9999 !important;
position: fixed !important;
display: none;
}
.uiPageProgress-show{
display: block;
}
</style>

35
src/Lsw.Abp.AntDesignUI/Components/UiPageProgress.razor.cs

@ -7,19 +7,20 @@ namespace Lsw.Abp.AntDesignUI.Components;
public partial class UiPageProgress : ComponentBase
{
private double? _percent;
private double _percent;
private ProgressStatus _progressStatus;
private string _css = "uiPageProgress";
private Dictionary<string, string> _gradients = new()
{
{ "0%", "#108ee9" },
{ "100%", "#87d068" }
};
[Inject]
protected IUiPageProgressService UiPageProgressService { get; set; }
[Inject] public IUiPageProgressService UiPageProgressService { get; set; }
protected override void OnInitialized()
{
base.OnInitialized();
@ -28,8 +29,28 @@ public partial class UiPageProgress : ComponentBase
protected virtual void OnProgressChanged(object sender, UiPageProgressEventArgs e)
{
_percent = e.Percentage;
_percent = e.Percentage ?? 0;
SetProgressStatus(e.Options.Type);
if (_percent != 0)
{
ShowProgress();
}
else
{
HideProgress();
}
StateHasChanged();
}
protected virtual void ShowProgress()
{
_css = "uiPageProgress uiPageProgress-show";
}
protected virtual void HideProgress()
{
_css = "uiPageProgress";
}
protected virtual void SetProgressStatus(UiPageProgressType pageProgressType)

9
src/Lsw.Abp.AntDesignUI/_Imports.razor

@ -1,2 +1,9 @@
@using Microsoft.AspNetCore.Components.Web
@using System.Net.Http
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.JSInterop
@using AntDesign
@using Lsw.Abp.AntDesignUI
@using Lsw.Abp.AntDesignUI.Components

12
test/AntDesignUIApp/AntDesignAppBrandBrandingProvider.cs

@ -0,0 +1,12 @@
using Volo.Abp.DependencyInjection;
using Volo.Abp.Ui.Branding;
namespace AntDesignUIApp;
[Dependency(ReplaceServices = true)]
public class AntDesignAppBrandBrandingProvider : DefaultBrandingProvider
{
public override string AppName => "AntDesignApp";
public override string LogoUrl => "logo.svg";
}

36
test/AntDesignUIApp/AntDesignUIAppMenuContributor.cs

@ -0,0 +1,36 @@
using Volo.Abp.UI.Navigation;
namespace AntDesignUIApp;
public class AntDesignUiAppMenuContributor : IMenuContributor
{
public Task ConfigureMenuAsync(MenuConfigurationContext context)
{
if (context.Menu.Name == StandardMenus.Main)
{
context.Menu.Items.Insert(
0,
new ApplicationMenuItem(
"Home",
"Home",
"/",
icon: "home"
)
);
var admin = new ApplicationMenuItem("Admin", "Admin");
admin.AddItem(new ApplicationMenuItem("Users",
"Users",
"/Users"));
admin.AddItem(new ApplicationMenuItem("Roles",
"Roles",
"/Roles"));
context.Menu.AddItem(admin);
}
return Task.CompletedTask;
}
}

7
test/AntDesignUIApp/AntDesignUIAppModule.cs

@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies;
using Volo.Abp.Autofac.WebAssembly;
using Volo.Abp.Modularity;
using Volo.Abp.UI.Navigation;
namespace AntDesignUIApp;
@ -24,6 +25,12 @@ public class AntDesignUIAppModule : AbpModule
options.AppAssembly = typeof(AntDesignUIAppModule).Assembly;
});
Configure<AbpNavigationOptions>(options =>
{
options.MenuContributors.Add(new AntDesignUiAppMenuContributor());
});
context.Services.AddTransient(sp => new HttpClient
{
BaseAddress = new Uri(environment.BaseAddress)

6
test/AntDesignUIApp/FakeAbpApplicationConfigurationAppService.cs

@ -17,7 +17,11 @@ public class FakeAbpApplicationConfigurationAppService : AbpApplicationConfigura
Auth = new ApplicationAuthConfigurationDto(),
Clock = new ClockDto(),
CurrentTenant = new CurrentTenantDto(),
CurrentUser = new CurrentUserDto(),
CurrentUser = new CurrentUserDto()
{
Name = "admin",
UserName = "admin"
},
Features = new ApplicationFeatureConfigurationDto(),
Localization = new ApplicationLocalizationConfigurationDto(),
MultiTenancy = new MultiTenancyInfoDto(),

7
test/AntDesignUIApp/Pages/Index.razor

@ -1,5 +1,6 @@
@page "/"
<AbpPageHeader Title="Index" BreadcrumbItems="@BreadcrumbItems"/>
<p>hello world</p>
<AbpPageHeader Title="Index" BreadcrumbItems="@BreadcrumbItems" Toolbar="@Toolbar"/>
<div class="page-content">
<p>hello world</p>
</div>

26
test/AntDesignUIApp/Pages/Index.razor.cs

@ -1,5 +1,8 @@
using Lsw.Abp.AntDesignUI;
using Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme.PageToolbars;
using Microsoft.AspNetCore.Components;
using Volo.Abp.AspNetCore.Components.Notifications;
using Volo.Abp.AspNetCore.Components.Progression;
namespace AntDesignUIApp.Pages;
@ -7,11 +10,34 @@ public partial class Index : ComponentBase
{
public List<BreadcrumbItem> BreadcrumbItems { get; set; } = new();
public PageToolbar Toolbar { get; set; } = new();
[Inject]
public IUiNotificationService NotificationService { get; set; }
[Inject]
public IUiPageProgressService UiPageProgressService { get; set; }
protected override void OnInitialized()
{
BreadcrumbItems = new List<BreadcrumbItem>()
{
new("Index")
};
Toolbar.AddButton("Notification", () => NotificationService.Info("new item!"), "plus");
Toolbar.AddButton("Page progress", async () =>
{
var i = 0;
while (i < 100)
{
i++;
await UiPageProgressService.Go(i);
await Task.Delay(50);
}
await UiPageProgressService.Go(null);
}, "double-right");
}
}

6
test/AntDesignUIApp/Pages/Roles.razor

@ -0,0 +1,6 @@
@page "/roles"
<AbpPageHeader Title="Roles" BreadcrumbItems="@BreadcrumbItems"/>
<div class="page-content">
<p>Role page</p>
</div>

18
test/AntDesignUIApp/Pages/Roles.razor.cs

@ -0,0 +1,18 @@
using Lsw.Abp.AntDesignUI;
using Microsoft.AspNetCore.Components;
namespace AntDesignUIApp.Pages;
public partial class Roles : ComponentBase
{
public List<BreadcrumbItem> BreadcrumbItems { get; set; } = new();
protected override void OnInitialized()
{
BreadcrumbItems = new List<BreadcrumbItem>()
{
new("Admin"),
new("Roles")
};
}
}

6
test/AntDesignUIApp/Pages/Users.razor

@ -0,0 +1,6 @@
@page "/users"
<AbpPageHeader Title="Users" BreadcrumbItems="@BreadcrumbItems"/>
<div class="page-content">
<p>Users page</p>
</div>

18
test/AntDesignUIApp/Pages/Users.razor.cs

@ -0,0 +1,18 @@
using Lsw.Abp.AntDesignUI;
using Microsoft.AspNetCore.Components;
namespace AntDesignUIApp.Pages;
public partial class Users : ComponentBase
{
public List<BreadcrumbItem> BreadcrumbItems { get; set; } = new();
protected override void OnInitialized()
{
BreadcrumbItems = new List<BreadcrumbItem>()
{
new("Admin"),
new("Users")
};
}
}

126
test/AntDesignUIApp/wwwroot/global.css

File diff suppressed because one or more lines are too long

4
test/AntDesignUIApp/wwwroot/index.html

@ -8,7 +8,7 @@
<base href="/" />
<!--ABP:Styles-->
<link href="global.css?_v=637816878164034163" rel="stylesheet"/>
<link href="global.css?_v=637817642493116648" rel="stylesheet"/>
<!--/ABP:Styles-->
</head>
@ -21,7 +21,7 @@
</div>
<!--ABP:Scripts-->
<script src="global.js?_v=637816878165418374"></script>
<script src="global.js?_v=637817642494486614"></script>
<!--/ABP:Scripts-->
</body>
</html>

43
test/AntDesignUIApp/wwwroot/logo.svg

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="200px" height="200px" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 47.1 (45422) - http://www.bohemiancoding.com/sketch -->
<title>Group 28 Copy 5</title>
<desc>Created with Sketch.</desc>
<defs>
<linearGradient x1="62.1023273%" y1="0%" x2="108.19718%" y2="37.8635764%" id="linearGradient-1">
<stop stop-color="#4285EB" offset="0%"></stop>
<stop stop-color="#2EC7FF" offset="100%"></stop>
</linearGradient>
<linearGradient x1="69.644116%" y1="0%" x2="54.0428975%" y2="108.456714%" id="linearGradient-2">
<stop stop-color="#29CDFF" offset="0%"></stop>
<stop stop-color="#148EFF" offset="37.8600687%"></stop>
<stop stop-color="#0A60FF" offset="100%"></stop>
</linearGradient>
<linearGradient x1="69.6908165%" y1="-12.9743587%" x2="16.7228981%" y2="117.391248%" id="linearGradient-3">
<stop stop-color="#FA816E" offset="0%"></stop>
<stop stop-color="#F74A5C" offset="41.472606%"></stop>
<stop stop-color="#F51D2C" offset="100%"></stop>
</linearGradient>
<linearGradient x1="68.1279872%" y1="-35.6905737%" x2="30.4400914%" y2="114.942679%" id="linearGradient-4">
<stop stop-color="#FA8E7D" offset="0%"></stop>
<stop stop-color="#F74A5C" offset="51.2635191%"></stop>
<stop stop-color="#F51D2C" offset="100%"></stop>
</linearGradient>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="logo" transform="translate(-20.000000, -20.000000)">
<g id="Group-28-Copy-5" transform="translate(20.000000, 20.000000)">
<g id="Group-27-Copy-3">
<g id="Group-25" fill-rule="nonzero">
<g id="2">
<path d="M91.5880863,4.17652823 L4.17996544,91.5127728 C-0.519240605,96.2081146 -0.519240605,103.791885 4.17996544,108.487227 L91.5880863,195.823472 C96.2872923,200.518814 103.877304,200.518814 108.57651,195.823472 L145.225487,159.204632 C149.433969,154.999611 149.433969,148.181924 145.225487,143.976903 C141.017005,139.771881 134.193707,139.771881 129.985225,143.976903 L102.20193,171.737352 C101.032305,172.906015 99.2571609,172.906015 98.0875359,171.737352 L28.285908,101.993122 C27.1162831,100.824459 27.1162831,99.050775 28.285908,97.8821118 L98.0875359,28.1378823 C99.2571609,26.9692191 101.032305,26.9692191 102.20193,28.1378823 L129.985225,55.8983314 C134.193707,60.1033528 141.017005,60.1033528 145.225487,55.8983314 C149.433969,51.69331 149.433969,44.8756232 145.225487,40.6706018 L108.58055,4.05574592 C103.862049,-0.537986846 96.2692618,-0.500797906 91.5880863,4.17652823 Z" id="Shape" fill="url(#linearGradient-1)"></path>
<path d="M91.5880863,4.17652823 L4.17996544,91.5127728 C-0.519240605,96.2081146 -0.519240605,103.791885 4.17996544,108.487227 L91.5880863,195.823472 C96.2872923,200.518814 103.877304,200.518814 108.57651,195.823472 L145.225487,159.204632 C149.433969,154.999611 149.433969,148.181924 145.225487,143.976903 C141.017005,139.771881 134.193707,139.771881 129.985225,143.976903 L102.20193,171.737352 C101.032305,172.906015 99.2571609,172.906015 98.0875359,171.737352 L28.285908,101.993122 C27.1162831,100.824459 27.1162831,99.050775 28.285908,97.8821118 L98.0875359,28.1378823 C100.999864,25.6271836 105.751642,20.541824 112.729652,19.3524487 C117.915585,18.4685261 123.585219,20.4140239 129.738554,25.1889424 C125.624663,21.0784292 118.571995,14.0340304 108.58055,4.05574592 C103.862049,-0.537986846 96.2692618,-0.500797906 91.5880863,4.17652823 Z" id="Shape" fill="url(#linearGradient-2)"></path>
</g>
<path d="M153.685633,135.854579 C157.894115,140.0596 164.717412,140.0596 168.925894,135.854579 L195.959977,108.842726 C200.659183,104.147384 200.659183,96.5636133 195.960527,91.8688194 L168.690777,64.7181159 C164.472332,60.5180858 157.646868,60.5241425 153.435895,64.7316526 C149.227413,68.936674 149.227413,75.7543607 153.435895,79.9593821 L171.854035,98.3623765 C173.02366,99.5310396 173.02366,101.304724 171.854035,102.473387 L153.685633,120.626849 C149.47715,124.83187 149.47715,131.649557 153.685633,135.854579 Z" id="Shape" fill="url(#linearGradient-3)"></path>
</g>
<ellipse id="Combined-Shape" fill="url(#linearGradient-4)" cx="100.519339" cy="100.436681" rx="23.6001926" ry="23.580786"></ellipse>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

Loading…
Cancel
Save