Code Monkey home page Code Monkey logo

bootstrapblazor's Introduction

Bootstrap Blazor Component

A set of enterprise-class UI components based on Bootstrap and Blazor.

Security Status

oscs License Nuget Nuget Repo Size Commit Date Github build codecov

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.
  • .NET Standard 2.1 based, with direct reference to the rich .NET ecosystem.
  • Supports NET5. (Server-Side, WASM)
  • Seamless integration with existing ASP.NET Core MVC and Razor Pages projects.

Online Examples

website website

Installation Guide

Create a new project from the dotnet new template

  1. Install the template

dotnet new install Bootstrap.Blazor.Templates::*

  1. Create the Boilerplate project with the template

dotnet new bbapp

Install Bootstrap Blazor Project Template

  1. Download Project Template

Microsoft Market link

  1. Double Click BootstrapBlazor.UITemplate.vsix

Import Bootstrap Blazor into an existing project

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

dotnet add package BootstrapBlazor

  1. Add the stylesheet javascripts file to your main index file - Pages/_Host.cshtml (Server) or wwwroot/index.html (WebAssembly)

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    . . .
    <link rel="stylesheet" href="_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css">
</head>
<body>
    . . .
    <script src="_framework/blazor.server.js"></script>
    <script src="_content/BootstrapBlazor/js/bootstrap.blazor.bundle.min.js"></script>
</body>
</html>
  1. Open the ~/Startup.cs file in the and register the Bootstrap Blazor service:

C#

namespace BootstrapBlazorAppName
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            //more code may be present here
            services.AddBootstrapBlazor();
        }

        //more code may be present here
    }
}

Visual Studio Integration

To create a new Bootstrap Blazor UI for Blazor application, use the Create New Project Wizard. The wizard detects all installed versions of Bootstrap Blazor for Blazor and lists them in the Version combobox—this enables you to start your project with the desired version. You can also get the latest version to make sure you are up to date.

  1. Get the Wizard

To use the Create New Project Wizard, install the Bootstrap Blazor UI for Blazor Visual Studio Extensions. You can get it from the:

  • Visual Studio Marketplace (for Windows)
  1. Start the Wizard

To start the wizard, use either of the following approaches

Using the Project menu:

  • Click File > New > Project.
  • Find and click the C# Blazor Application option (you can use the search, or filter by Blazor templates).
  • Follow the wizard.

Supported browsers

chrome firefox edge ie Safari Andriod oper

Mobile devices

ios Andriod windows

Chrome Firefox Safari Android Browser & WebView Microsoft Edge
iOS Supported Supported Supported N/A Supported
Android Supported Supported N/A Android v5.0+ supported Supported
Windows 10 Mobile N/A N/A N/A N/A Supported

Desktop browsers

macOS linux windows

Chrome Firefox Internet Explorer Microsoft Edge Opera Safari
Mac Supported Supported N/A N/A Supported Supported
Linux Supported Supported N/A N/A N/A N/A
Windows Supported Supported Supported, IE11+ Supported Supported Not supported

Screenshots

Toggle Toast Upload Upload2 Bar Pei Doughnut

Contribution

  1. Fork
  2. Create Feat_xxx branch
  3. Commit
  4. Create Pull Request

Donate

If this project is helpful to you, please scan the QR code below for a cup of coffee.

bootstrapblazor's People

Contributors

a5196060 avatar argozhang avatar axxbis avatar azlis avatar bdbox1 avatar chenzanyu avatar circlelee1981 avatar conwaychengit avatar cqjxtech avatar densen2014 avatar figo1001 avatar hsin19 avatar j4587698 avatar jinybing avatar kimdiego2098 avatar luohuarain avatar luoluo-mosthandsomeone avatar namelhp2000 avatar pomeara avatar ponderfly avatar qjr87 avatar stevenbase avatar tzm1119 avatar vision-zhang avatar wettstein-guebau avatar william19941994 avatar ysmc-w avatar yuanan avatar zhouqime avatar zph19970424 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  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

bootstrapblazor's Issues

Input添加自定义验证器

希望给BootstrapInput等输入组件,以及TableColumn或者自动生成的TableColumn等添加自定义验证器功能

DropdownList的OnSelectedItemChanged产生了死循环。(bootstrapBlazor版本5.0.7和3.1.30)

<DropdownList Data="@Items"
@bind-Value="@SelectedItem"
OnSelectedItemChanged="@(new Action(v => {result = v;}))"
TextField="Text"
ValueField="Value">

双向绑定对象值:@SelectedItem

@code{
private int SelectedItem { get; set; } = 2;

int result = -1;
IEnumerable<Item> Items = Enumerable.Range(1, 100).ToList().Select(c => new Item() { Value =  c, Text = "Text" + c });
public class Item
{
    public int Value { get; set; }
    public string Text { get; set; }
}

}

在ValidateForm下使用带Checkbox的Tree组件会导致出现多余文本

<ValidateForm class="form-inline" Model="@model" OnValidSubmit="OnValidSubmit">
    <div class="row">
        <div class="form-group col-12">
            <BootstrapInput minlength="9" maxlength="9"  @bind-Value="@model.id">
            </BootstrapInput>
            <Tree
                Items="@TreeItems"
                ClickToggleNode
                ShowCheckbox>
            </Tree>
        </div>
    </div>
</ValidateForm>

图中Checked即是意外文本, 通过查看源代码我知道是因为Tree调用了Checkbox, 而Checkbox下的EditForm不为空. 我大致翻了一下未能找到在当前代码下关掉这个特性的选项,

如果真没有的话我就提PR吧

image

wasm下, 变量或者类在 <TabItems> <TabItem> 里面无法自动刷新,环境core3.1

   <Tab>
<TabItems> <TabItem> 
                                        <Button Color="Color.Success" @onclick="@(() => AddPerson(foods,-1))">- </Button>
                                        <Badge Color="Color.Success">
                                            <span>@foods.qty</span>
                                        </Badge>
                                        <Button Color="Color.Success" @onclick="@(() => AddPerson(foods))">+ </Button>
</TabItem> </TabItems>
    </Tab>

  public class Food
   {
       public string name { get; set; }
       public float price { get; set; }
       public float oldPrice { get; set; }
       public string description { get; set; }
       public int sellCount { get; set; }
       public int rating { get; set; }
       public object info { get; set; }
       public string icon { get; set; }
       public string image { get; set; }
       public string UserCode { get; set; }
       public object timestamp { get; set; }
       public int ProductID { get; set; }
       public int qty { get; set; }
   }

代码在TabItem里面就不会自动刷新qty, 放到TabItem外面就能良好工作,

使用的包
"BootstrapBlazor" Version="3.1.11-beta05"

Table的SaveAsync,在使用注入服务操作,EditMode="EditMode.EditForm"模式下, 表格插入新记录时候不能刷新数据

测试代码

    <Table TItem="School"
           IsPagination="true"
           EditMode="EditMode.EditForm"
           IsStriped="true" IsBordered="true" IsMultipleSelect="true" AutoGenerateColumns="true" ShowSearch="true"
           ShowToolbar="true" ShowExtendButtons="true" ShowSkeleton="true" DoubleClickToEdit="true" UseInjectDataService="true">
    </Table>

貌似这样能修复

src\BootstrapBlazor\Components\Table\Table.razor.Toolbar.cs

        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="context"></param>
        protected async Task SaveAsync(EditContext context)
        {
            if (UseInjectDataService || OnSaveAsync != null)
            {
                if (await SaveModelAsync(context))
                {
                    if (EditMode == EditMode.Popup)
                    {
                        await QueryAsync();
                    }
                    else if (EditMode == EditMode.EditForm)
                    {
                         if (ShowAddForm) await QueryAsync();
                        ShowAddForm = false;
                        ShowEditForm = false; 
                        StateHasChanged();
                    }
                }
            }
            else
            {
                var option = new ToastOption
                {
                    Category = ToastCategory.Error,
                    Title = SaveButtonToastTitle,
                    Content = SaveButtonToastContent
                };
                await Toast.Show(option);
            }
        }

发生js调用错误

我使用的是.net core 3.1,根据教程安装后,在razor中试图调用时报错:
Microsoft.JSInterop.JSException: Could not find '$' in 'window'.

DateTimeRange组件棒棒哒! 顺便来点小小建议.

Is your feature request related to a problem? Please describe.

1.DateTimeRange组件建议选择开始时间后,如果不选结束时间,end.value直接等于start.value,
2.建议加入[今日]按钮,对于我这种时间日期盲,会比较好操作
3.建议加一个 OnClear,取消日期选择也需要回调后台查询,不想再点击一次查询按钮. 我非常懒.

Describe the solution you'd like

  1. 这样可以选单日, 而不是返回 0001-1-1后台查询会报错
    value.End==new DateTime (1,1,1,0,0,0)? value.Start: value.End

2.如图
加入今日按钮

Row highlighting

I have been unable to find a way to highlight a row based on the context of the current row, is it possible to add this feature of if it's already available could you please add an example

Many thanks - great repo

TableColumn 的 Template 中的 Popover 在翻页时不会更新

Table 的 Template 中嵌入的 Popover 在翻页后不会更新(始终为第一页对应元素的内容)

<Table TItem="BindItem"
       IsPagination="true" PageItemsSource="@ItemsSource"
       SearchModel="@SearchModel"
       ShowSearch="true"
       IsStriped="true" IsBordered="true"
       ShowSkeleton="true"
       OnQueryAsync="@OnQueryAsync">
    <TableColumns>
        <TableColumn @bind-Field="@context.Description" Width="100" Filterable="true">
            <Template Context="value">
                <Button Color="Color.Link">
                    @StringTruncat(value.Value, 15)
                    <Popover Placement="Placement.Top" Title="Items" Content="@value.Value" IsHtml="true" />
                </Button>   
            </Template>
        </TableColumn>
    </TableColumns>
</Table>

Translate the docs to english

Is your feature request related to a problem? Please describe.

translate the docs to english

Describe the solution you'd like

  • open json file in to ~/BootstrapBlazor.Shared/Locales
  • update the docs under ~/BootstrapBlazor.Shared/Pages folder content

Additional context

  • Alerts
  • Anchors
  • AutoCompletes
  • Avatars
  • Badges
  • BarcodeReaders
  • Breadcrumbs
  • Buttons
  • Calendars
  • Cameras
  • Capthcas
  • Cards
  • Carousels
  • CheckboxLists
  • Checkboxs
  • Circles
  • Collapses
  • Coms
  • Consoles

MainLayout调用Modal没效果

请教下,在MainLayout.razor上调用DialogService的Show事件不会弹出对话框,源码跟踪到是Dialog.razor里的ModalDialog没有映射出来,因此抛出空对象异常;其他地方调用DialogService的Show事件可以正常弹出对话框

RTL Support

Greate work, great effort
do you plan to support right to left direction for other language like arabic

当字段很多,设定一个字段[AutoGenerateColumn( Fixed =true)]后,table自动建立字段花屏 :->

实体表30个字段,其中第一个名称字段设置了 [AutoGenerateColumn( Fixed =true)],其余未配置任何特性
表格使用了AllowResizing="true"

<Table TItem="AppCssConfig"
       IsPagination="true"
       IsStriped="true" IsBordered="true" IsMultipleSelect="true" AutoGenerateColumns="true" ShowSearch="true"
       ShowToolbar="true" ShowExtendButtons="true" ShowSkeleton="true" DoubleClickToEdit="true" UseInjectDataService="true"
       AllowResizing="true">

生成表格全乱了
QQ截图20210307005232

Layout Page with Multitab mode, can not navigate to authentication/login. and menu url cannot match route

Describe the bug

Use Layout Page with Multitab mode, can not navigate to authentication/login. and menu url cannot match route parameters

To Reproduce

This is a sample https://github.com/geffzhang/Abp.BootstrapTheme, run Abp.BootstrapTheme.Blazor.Host、Abp.BootstrapTheme.HttpApi.Host and Abp.BootstrapTheme.IdentityServer 。

Blazor.Host Project Index page click Login can't navigate to authentication/login Layout Page with Multitab mode . swaitch to single page . It can be navigate to authentication/login.

Further technical details

  • BootstrapBlazor 5.0.12
  • Include the output of dotnet --info
    C:\Users\geffzhang>dotnet --info
    .NET SDK (反映任何 global.json):
    Version: 5.0.102
    Commit: 71365b4d42

运行时环境:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.102\

Host (useful for support):
Version: 5.0.2
Commit: cb5f173b96

.NET SDKs installed:
2.1.812 [C:\Program Files\dotnet\sdk]
3.1.402 [C:\Program Files\dotnet\sdk]
3.1.405 [C:\Program Files\dotnet\sdk]
5.0.101 [C:\Program Files\dotnet\sdk]
5.0.102 [C:\Program Files\dotnet\sdk]

嵌套字段无法应用于表格组件

To Reproduce

使用模板创建一份项目, 在Index.razor中添加如下代码后运行 blazor server.

打开/页面后, 稳定复现NullReferenceException, 异常的调用栈全丢失了, 基本看不到原因所在, 只是通过测试发现是嵌入式字段引起的, 注释掉<TableColumn @bind-Field="@context.more.address" />异常消失.

异常与Items的长度无关.

<Table TItem="Test" Items="@Items">
    <TableColumns>
        <TableColumn @bind-Field="@context.name" />
        <TableColumn @bind-Field="@context.more.address" />
    </TableColumns>
</Table>

@code {

    class More {
        public string address;
    }
    class Test {
        public string name;
        public More more;
    }

    // List<Test> Items = new List<Test>(){new Test(){ name = "名", more = new More(){address = "址"}} };
    List<Test> Items = new List<Test>();

}

Further technical details

  • BootstrapBlazor 5.0.16-beta01
  • .NET 5.0

怎么设置font

你好,编译出来的bootstrap.blazor.css里设定的font:
html, body, button, .popover {
font-family: Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,SimSun,sans-serif;
}
我想设置别的font,请教一下在代码里能实现自己重设font吗?要不然每次编译之后font都是上面这样的,每次都得手改。
谢谢!

Table组件ShowAddButton绑定属性导致添加按钮显示异常

模板代码改动和效果如图,新添加的按钮“添加按钮”多点击几次就会生成多个"新建"按钮
image
image

 @page "/table"

<h1>Table</h1>

<Table TItem="Foo" IsPagination="true" PageItemsSource="@PageItemsSource"
       IsStriped="true" IsBordered="true" ShowSkeleton="true" IsMultipleSelect="true"
       ShowAddButton="ShowAdd"
       EditMode="EditMode.EditForm"
       ShowToolbar="true" ShowSearch="true" ShowExtendButtons="true"
       UseInjectDataService="true" AutoGenerateColumns="true">
    <TableColumns>
        <TableColumn @bind-Field="@context.Complete">
            <Template Context="v">
                <Switch IsDisabled="true" Value="v.Value" ShowInnerText="true" OnInnerText="是" OffInnerText="否" />
            </Template>
        </TableColumn>
        <TableColumn @bind-Field="@context.Hobby" Data="@Hobbys" />
    </TableColumns>
</Table>

<Button Text="添加按钮" OnClick="() => ShowAdd = !ShowAdd"></Button>

@code
{
    public bool ShowAdd { get; set; }
}

decimal?字段自动生成的table编辑界面保存不了

Describe the bug

decimal?字段自动生成的table编辑界面保存不了

类字段定义

        [AutoGenerateColumn(Order = 29, Filterable = true, Sortable = true)]
        public decimal? Prepaid { get; set; }

生成的html
<input type="number" id="bb_15798577_Prepaid" class="form-control valid">

QQ图片20210205031520

IE 11的環境下使用Layout組件會報錯

會出現以下錯誤
Error: Microsoft.JSInterop.JSException: Could not find '$.bb_layout' ('$' was undefined).
在Chrome, Edge, FireFox測試過都正常
拿掉Layout組件後正常

栅格系统

请问该组件有无栅格系统使用,我用原生的Bootstrap好像对表单组件不起作用。

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.