Giter Club home page Giter Club logo

blazor-pro-components's Introduction

Ant Design Blazor

A rich set of enterprise-class UI components based on Ant Design and Blazor.

Build AntDesign AntDesign AntDesign.Templates codecov AntDesign Ding Talk Group Discord Server

English | 简体中文

✨ Features

  • 🌈 Enterprise-class UI designed for web applications.
  • 📦 A set of high-quality Blazor components out of the box.
  • 💕 Supports WebAssembly-based client-side and SignalR-based server-side UI event interaction.
  • 🎨 Supports Progressive Web Applications (PWA).
  • 🛡 Build with C#, a multi-paradigm static language for an efficient development experience.
  • 🌍 Internationalization support for dozens of languages.
  • 🎁 Seamless integration with existing ASP.NET Core MVC and Razor Pages projects.

🌈 Online Examples

WebAssembly static hosting on:

🖥 Environment Support

  • Supports .NET Core 3.1 / .NET 5 / .NET 6 / .Net 7 / .NET 8.
  • Supports WebAssembly static file deployment.
  • Supports 4 major browsers engines, and Internet Explorer 11+ (Blazor Server only)
  • Supports .NET MAUI / WPF / Windows Forms and other Blazor Hybrid workloads.
  • Supports Electron and other Web standards-based environments.

Due to WebAssembly restriction, Blazor WebAssembly doesn't support IE browser, but Blazor Server supports IE 11† with additional polyfills. See official documentation.

From .NET 5, IE 11 is no longer officially supported. See Blazor: Updated browser support. Unofficial support is provided by Blazor.Polyfill community project.

💿 Current Version

🎨 Design Specification

Regularly synchronize with Official Ant Design specifications, you can check the sync logs online.

Therefore, you can use the custom theme styles of Ant Design directly.

Before the 1.0 release, we will only sync antd 4.x styles.

📦 Installation Guide

Prerequirement

Option 1: Create a new project from the dotnet new template AntDesign.Templates

We have provided the dotnet new template to create a Boilerplate project out of the box:

Pro Template

  • Install the template

    $ dotnet new --install AntDesign.Templates
  • Create the Boilerplate project with the template

    $ dotnet new antdesign -o MyAntDesignApp

Options for the template:

Options Description Type Default
-f | --full If specified, generates all pages of Ant Design Pro bool false
-ho | --host Specify the hosting model 'wasm' | 'server' | 'hosted' 'wasm'
--styles Whether use NodeJS and Less to compile your custom themes. css | less css
--no-restore If specified, skips the automatic restore of the project on create bool false

Option 2: Import Ant Design Blazor into an existing project

  • Go to the project folder of the application and install the Nuget package reference

    $ dotnet add package AntDesign
  • Register the services in Program.cs

    builder.Services.AddAntDesign();

    or Startup.cs

    services.AddAntDesign();
  • Add namespace in _Imports.razor

    @using AntDesign
  • To display the pop-up component dynamically, you need to add the <AntContainer /> component in App.razor.

    • For Blazor WebApp, you also need to specify render mode to <Routes /> for interactivity.
    <Routes @rendermode="RenderMode.InteractiveAuto" />            <-- specify the rendermode ✨
    + <AntContainer @rendermode="RenderMode.InteractiveAuto" />    <-- add this component ✨
    • For legacy blazor apps just add a line of code:
    <Router AppAssembly="@typeof(MainLayout).Assembly">
        <Found Context="routeData">
            <RouteView RouteData="routeData" DefaultLayout="@typeof(MainLayout)" />
        </Found>
        <NotFound>
            <LayoutView Layout="@typeof(MainLayout)">
                <Result Status="404" />
            </LayoutView>
        </NotFound>
    </Router>
    
    +  <AntContainer />   <-- add this component ✨
  • Finally, it can be referenced in the .razor component!

    <Button Type="@ButtonType.Primary">Hello World!</Button>

🔨 Development

Gitpod

Click the button below to start a new workspace for development for free.

Open in Gitpod

Local

  • Install .NET Core SDK 8.0.100 or later.

  • Install Node.js (only for building style files and interoperable TypeScript files)

  • Clone to local development

    $ git clone https://github.com/ant-design-blazor/ant-design-blazor.git
    $ cd ant-design-blazor
    $ npm install
    $ dotnet build ./site/AntDesign.Docs.Build/AntDesign.Docs.Build.csproj
    $ npm start
  • Visit https://localhost:5001 in your supported browser and check local development documentation for details.

    Visual Studio 2022 is recommended for development.

🔗 Links

🗺 Roadmap

Check out this issue to learn about our development plans for the 1.0 release.

You can also find the latest news about the features we will implement in the future with antd5.0 style.

🤝 Contributing

PRs Welcome

If you would like to contribute, feel free to create a Pull Request, or give us Bug Report.

💕 Donation

This project is an MIT-licensed open source project. In order to achieve better and sustainable development of the project, we expect to gain more backers. We will use the proceeds for community operations and promotion. You can support us in any of the following ways:

We will put the detailed donation records on the backer list.

❓ Community Support

If you encounter any problems in the process, feel free to ask for help via following channels. We also encourage experienced users to help newcomers.

  • Discord Server

  • 钉钉群

    Scan QR Code with DingTalk

Contributors

This project exists thanks to all the people who contribute.

Code of Conduct

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information see the .NET Foundation Code of Conduct.

☀️ License

AntDesign

.NET Foundation

This project is supported by the .NET Foundation.

blazor-pro-components's People

Contributors

alexbits avatar anddrzejb avatar coderjohnzhou avatar elderjames avatar jkfoong avatar kwinkel avatar qyperion avatar runaho avatar shirleen1234 avatar wangj90 avatar yoli799480165 avatar zxyao145 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

blazor-pro-components's Issues

Can BaseMenu add IconFont support?

static readonly RenderFragment<MenuDataItem> title= menuItem => @<span>
                                                                    @if (!string.IsNullOrEmpty(menuItem.Icon))
                                                                    {
                                                                        <Icon Type="@menuItem.Icon" Theme="outline"  />
                                                                    }
                                                                   @if (!string.IsNullOrEmpty(menuItem.IconFont))
                                                                    {
                                                                        <IconFont Type="@menuItem.IconFont" />
                                                                    }


public class MenuDataItem
{
    public string[] Authority { get; set; }
    public virtual MenuDataItem[] Children { get; set; }
    public bool HideChildrenInMenu { get; set; }
    public bool HideInMenu { get; set; }
    public string Icon { get; set; }
    public string IconFont { get; set; }  //Add
    public string Locale { get; set; }
    public virtual string Name { get; set; }
    public string Key { get; set; }
    public string Path { get; set; }
    public string[] ParentKeys { get; set; }
    public NavLinkMatch Match { get; set; }
}

}

多应用共享MenuData时,出现折叠问题

OGW4N LO$TFKUR61Q4GX YX

我这里后台是多应用模式+共享左边的菜单。
应用切换后,菜单也会随之变化。

<BasicLayout Logo="@("https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg")"
             MenuData="leftMenus">
    <RightContentRender>
        <RightContent @bind-User="@User" MenuData="topMenus" MenuDataChanged="MenuChanged" />
    </RightContentRender>

当我topMenus(目前只有一级菜单)点击之后, leftMenus 会进行重新赋值。
左边的菜单内容会对应的刷新, 但是折叠状态依旧保留之间。
建议增加一个菜单折叠接口出来,或者内部判定当MenuData发生变化的时候, 重置菜单伸缩状态。

Question: RightContent.razor should not be a component?

I am having a problem justifying the RightContent.razor as a component. First it gave me a lot of trouble when I tried to use AntDesign.Pro full version. I will in steps describe what I did and what I noticed:

  1. I created a new AntDesign.MySite project using command line dotnet new antdesign --host=server --full
  2. I found the template created files (among others) Layouts/BasicLayout.razor and Components/GlobalHeader/RightContent.razor. The latter is responsible for rendering of notification center, language picker and quick user actons. That RightContent component is consumed by BasicLayout component.
  3. I wanted to do some customizations so I started changing the projects RightContent.razor. Whatever I was doing, no changes was reflected.
  4. Eventually I figured that the RightContent that was used was actually a component of pro-components. So I had to fully qualify the RightContent in BasicLayout like this: <AntDesign.MySite.Components.RightContent />
  5. I cannot use F12 yet on razor components (source). Figuring out the source of my problem took me much more time than it should 😢 .
  6. It seems that RightContent does not expose enough api to be useful, so it has to be altered anyway.

It absolutely makes sense to keep RightContent.razor as a part of AntDesign.Pro template, but I can only see it being as an obstacle at this stage if it is used in ProComponents.
In my tests I transferred all the code related to RightContent to AntDesign.Pro.Layout.Wasm project to folder Components/GlobalHeaders. Running the example project works as before.

Support ProTable

I am so limited to my own technology, I can't provide PR, so I can only help the maintainer.

cannot customize the language menu items

could you please update the parameters in SelectLang component to "CascadingParameter"? Then the language menu items can be customized without changing the layout component.

更新到0.18.2后,菜单刷新无法自动选中高亮

更新到0.18.2后,刷新无法自行选中.
在0.18.1时候没有问题,在未更改代码前提下升级0.18.2后,
刷新页面,首次加载左菜单后,无法自动将选中的当前菜单赋予高亮颜色.

此时点击其它菜单会有高亮

BaseMenu HideInMenu feature missing

Hi, I think HideInMenu feature is missing inside SiderMenu/BaseMenu.razor.

Current:

if (menuItem.Children != null && !menuItem.HideChildrenInMenu)
{
    <SubMenu TitleTemplate="@title(menuItem)" Key="@menuItem.Key">
        @menuItemTemplate((menuItem.Children, true))
    </SubMenu>
}
else
{
    <MenuItem Key="@menuItem.Key">
        <MenuLink href="@menuItem.Path" Match="@menuItem.Match">
            @title(menuItem)
        </MenuLink>
    </MenuItem>
}

To fix it:

if (menuItem.Children != null && !menuItem.HideChildrenInMenu)
{
    <SubMenu TitleTemplate="@title(menuItem)" Key="@menuItem.Key">
        @menuItemTemplate((menuItem.Children, true))
    </SubMenu>
}
else if (!menuItem.HideInMenu)
{
    <MenuItem Key="@menuItem.Key">
        <MenuLink href="@menuItem.Path" Match="@menuItem.Match">
            @title(menuItem)
        </MenuLink>
    </MenuItem>
}

Please correct me if I'm wrong. Thanks.

Drawer effect of side navigation bar in mobile terminal

Antd Pro will become a drawer effect on the mobile terminal. I tried to use the drawer component to achieve it, but the custom effect of the drawer component is relatively weak. I found that this has been implemented in Docs. Can it be introduced into Prolayout? In the default implementation?
image

BasicLayout -Menu event

How to create MenuItemClick event ?

< BasicLayout MenuData="MenuData" SiderWidth="300" >
< BasicLayout />

模板创建的项目0.13.0.1版本升级到0.14版本,页面加载不出来报错了。

/__w/1/s/src/mono/mono/eglib/gpath.c:115
/__w/1/s/src/mono/mono/eglib/gpath.c:115
info: AntDesign.ProLayout.BasicLayout[0]
BasicLayout initialized.
info: AntDesign.ProLayout.BaseMenu[0]
BaseMenu initialized.
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: No element is currently associated with component 11
Error: No element is currently associated with component 11
at ae.updateComponent (https://localhost:44358/_framework/blazor.webassembly.js:1:19821)
at https://localhost:44358/_framework/blazor.webassembly.js:1:56876
at St.Te._internal.renderBatch (https://localhost:44358/_framework/blazor.webassembly.js:1:57248)
at Object.Rt [as invokeJSFromDotNet] (https://localhost:44358/_framework/blazor.webassembly.js:1:59934)
at _mono_wasm_invoke_js_blazor (https://localhost:44358/_framework/dotnet.6.0.16.olpkzvz1qs.js:1:195300)
at wasm://wasm/00971dfe:wasm-function[3308]:0xc6137
at wasm://wasm/00971dfe:wasm-function[167]:0xd602
at wasm://wasm/00971dfe:wasm-function[166]:0xbd73
at wasm://wasm/00971dfe:wasm-function[2815]:0xabef4
at wasm://wasm/00971dfe:wasm-function[1619]:0x6fcb4
Microsoft.JSInterop.JSException: No element is currently associated with component 11
Error: No element is currently associated with component 11
at ae.updateComponent (https://localhost:44358/_framework/blazor.webassembly.js:1:19821)
at https://localhost:44358/_framework/blazor.webassembly.js:1:56876
at St.Te._internal.renderBatch (https://localhost:44358/_framework/blazor.webassembly.js:1:57248)
at Object.Rt [as invokeJSFromDotNet] (https://localhost:44358/_framework/blazor.webassembly.js:1:59934)
at _mono_wasm_invoke_js_blazor (https://localhost:44358/_framework/dotnet.6.0.16.olpkzvz1qs.js:1:195300)
at wasm://wasm/00971dfe:wasm-function[3308]:0xc6137
at wasm://wasm/00971dfe:wasm-function[167]:0xd602
at wasm://wasm/00971dfe:wasm-function[166]:0xbd73
at wasm://wasm/00971dfe:wasm-function[2815]:0xabef4
at wasm://wasm/00971dfe:wasm-function[1619]:0x6fcb4
at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[Int32,RenderBatch,Object,Object](String identifier, Int32 arg0, RenderBatch arg1, Object arg2, Int64 targetInstanceId)
at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[Int32,RenderBatch,Object](String identifier, Int32 arg0, RenderBatch arg1)
at Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer.UpdateDisplayAsync(RenderBatch& batch)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()

BasicLayout OnCollapse is not invoked

Hi there,

I believe HandleCollapse method should invoke OnCollapse event callback. Otherwise there is no way to detect when side menu is collapsed. Am I missing something?

private void HandleCollapse(bool collapsed)        
{  
Collapsed = collapsed;  
SetStyle();
}

should be

private void HandleCollapse(bool collapsed)
{
  Collapsed = collapsed;
  SetStyle();
  OnCollapse.InvokeAsync(collapsed);
}

Defaults for AntDesign.Pro

So I've been doing some changes in my project so I can use AntDesign.Pro. I noticed there is a ton of stuff that leaks from AntDesign.Pro to pro-components. What I mean is for example in AvatarDropdown the menu options are basically just hardcoded stuff that is needed to show-off AntDesign.Pro. This makes the components in that state useless. Same thing for SelectLang. What I'd like to do is to make it more flexible. What I want to do is just do a PR that will have a number of changes spanning through a number of different components. But on top of that, the changes would require also a separate PR in AntDesign.Pro. I figured since I do those changes in my project, I could apply them to the source 😉.

I want to do these big PRs because I do not know how long it is going to take it to merge if each change is done as a separate PR. And that will be really hard for me continue working on my stuff & keep multiple PRs... So is that going to be ok with you guys?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.