Compare commits

...

69 Commits

Author SHA1 Message Date
Argo-Cloud
bec80c230b refactor: 发布新版本 5.0.4 2020-11-27 15:10:16 +08:00
紫夜
8bc0dde834 !695 feat(#I278CM): DateTimeRange组件添加清空数据回调委托参数
* DateTimeRange组件添加OnClearValue回调委托方法,在点击清空按钮时调用委托;
2020-11-27 15:09:13 +08:00
Argo
e07872b035 !694 fix(#I277SM): 修复 FormItem 组件设置 Text 未生效问题
* fix: 修复 FormItem 组件未传递 Text 属性问题
2020-11-27 14:05:23 +08:00
Argo
edd534a482 !693 fix(#I277RA): 修复演示网站 new upd 标记错误问题
* refactor: 更正 DateTimeRange 组件 Upd 状态
2020-11-27 14:02:26 +08:00
Argo Zhang
3e33d5fce4 release: 发布新版本 5.0.4-beta06 2020-11-26 19:30:38 +08:00
Argo
4efc29fa09 !692 doc(#I274PC): 演示网站增加 Upd 状态显示
* refactor: 移除 new.svg 图标使用 badge 组件
2020-11-26 19:29:53 +08:00
Argo
63be429061 !691 feat(#I1YYMW): DateTimePicker 增加最大值与最小值设置
* doc: 增加示例代码
* style: 更新样式与脚本
* doc: 增加设置时间范围示例
* refactor: 设置最大值最小值包含关系
* feat: 此刻按钮在未设置时间范围时可用
* Merge branch 'dev-range' into dev-datetimepicker-max-min
* refactor: 更新 DateTimeRange 样式
* refactor: 判断条件移除 Ticks 属性
* refactor: DatePickerBody 增加最大值最小值设置
* Merge branch 'dev' into dev-datetimepicker-max-min
* refactor: 更改属性可为空
* refactor: 更新最大值
* feat: 增加最大值最小值参数
2020-11-26 19:01:25 +08:00
Argo
624f62bcd5 !690 feat(#I272JI): 演示网站增加 new 标示新组件
* feat: 增加 State 组件
* refactor: 重构 MenuItem 类方便继承
* doc: 增加 new.svg 资源
2020-11-26 14:41:34 +08:00
Argo
b6ec6f489f !689 feat(#I271AF): 增加德语选项菜单切换功能
* refactor: 增加德语选择项
2020-11-26 11:04:55 +08:00
Argo-Cloud
858b74f4d5 release: 发布新版本 5.0.4-beta05 2020-11-26 10:49:09 +08:00
Argo
7f4af1a424 !688 feat(#I2715P): Layout 组件增加 OnClickMenu 回调委托方法
* doc: 更新 Layout 组件文档增加 OnClickMenu 参数
* feat: Layout 组件增加 OnClickMenu 回调委托方法
2020-11-26 10:48:27 +08:00
Argo
a59f66382c !687 doc(#I2713F): 增加德语本地化资源文件
* doc: 增加德语资源
2020-11-26 10:41:09 +08:00
Argo-Cloud
44ce3c2e39 Merge branch 'dev'
# Conflicts:
#	src/BootstrapBlazor/Locales/en-US.json
2020-11-26 10:30:46 +08:00
Argo Zhang
7265292f91 Merge pull request #26 from pomeara/german_translations
Add German translations and adjust a typo
2020-11-26 10:28:19 +08:00
Patrick
e829845b17 Add German translations and adjust a typo 2020-11-26 11:05:00 +11:00
Argo Zhang
ff5a2f63e5 release: 发布新版本 5.0.4-beta04 2020-11-25 22:39:20 +08:00
Argo
9be7a86c93 !686 refactor(#I26ZC3): Rate 组件 IsDisabled 属性逻辑更新
* doc: 增加禁用组件示例文件
* doc: 增加 IsDisabled 属性介绍
* refactor: 清除不使用的代码
* style: 更新组件禁用样式
* refactor: 增加静态修饰符
* refactor: 增加禁用样式
* doc: 增加禁用示例文档
* doc: 增加禁用示例
2020-11-25 22:35:47 +08:00
Argo
815f5b4b9d !685 refactor(#I26RTN): 正页面代码生成演示代码更新
* doc: 更新正页面脚本文档
2020-11-25 22:34:22 +08:00
紫夜
77108d1536 !684 feat(#I26Y8T): Rate组件添加IsDisable属性
* Rate:添加IsDisable属性,用于控制组件是否可编辑,可双向绑定;
2020-11-25 16:58:56 +08:00
Argo-Cloud
e85274a1f9 release: 发布新版本 5.0.4-beta03 2020-11-24 16:24:32 +08:00
Argo
71f23ff73f !683 feat(#I26XXM): Table 组件增加 EditDialogSaveButtonText 属性
* doc: 更新文档
* feat: 增加 EditDialogSaveButtonText 更改保存弹窗中保存按钮文字
2020-11-25 16:24:17 +08:00
Argo
1353fc84ec !682 feat(#I26XLA): DateTimeRange 组件增加禁用功能
* style: 增加禁用组件样式
* feat: 增加禁用组件不调用 js 逻辑
* feat: 增加禁用样式
2020-11-25 15:54:32 +08:00
Argo
fc5496cec2 !679 feat(I1V72V): 增加 DateTimeRange 组件
* Merge branch 'dev' into dev-datetime-range2
* Squashed commit of the following:
* doc: 增加 禁用示例
* env: 更新 editorconfig 配置文件
* doc: 更新 Placement 属性值
* doc: 更新说明文档
* doc: 增加双向绑定示例
* doc: 增加示例文档
* refactor: 组件加载时设置时间默认值
* doc: 增加回调委托 OnConfirm 示例
* feat: 增加 OnConfirm 回调委托方法
* refactor: 移除泛型可为空约束
* refactor: 增加静态修饰符
* Squashed commit of the following:
* feat: 增加选择当月外时间逻辑
* feat: 增加区间日期样式
* feat: 点击确认按钮式关闭弹窗功能
* feat: 增加选中时间范围处理逻辑
* style: 增加选中时间范围样式
* feat: 增加开始时间与结束时间数据绑定
* feat: 增加 Clear 清除快捷按钮
* feat: 点击此刻按钮时直接返回值并且关闭弹窗
* scripts: 增加 DateTimeRange 点击文档其他地方关闭弹窗逻辑
* refactor: 移除不使用的回调方法
* doc: 增加 DateTimeRanges 示例页面
* scripts: 更新脚本与样式
* feat: 更新 DateTimeRange 组件逻辑
* refactor: DatePickerBody 增加逻辑适配 Range 组件
* feat: DatePickerBody 增加控制按钮显示属性
* fix: 修复 Centos 时间日期格式不正确问题
* doc: 更新资源文件
* feat: 增加 DateTimeRange 组件
* doc: 增加 DateTimeRange 组件菜单
* doc: 增加本地化资源文件
* doc: DateTimeBody 更新 ShowFooter 示例
* feat: DatePickerBody 增加 ShowFooter 属性
* refactor: 重构侧边栏显示逻辑
2020-11-25 12:15:44 +08:00
Argo-Cloud
bc8485e5c4 release: 发布新版本 5.0.4-beta02 2020-11-24 10:42:40 +08:00
Argo
7b33c1ae7f !681 feat(#I26SB0): Rate 组件增加 OnValueChanged 回调委托
* feat: 增加 OnValueChanged 回调委托
* refactor: 格式化子项目样式
* refactor: 移除 RateBase 基类
2020-11-24 17:16:56 +08:00
紫夜
6c0c323ad4 !680 修复Rate组件Value参数无法正常双向绑定的BUG
* Rate:修复Value无法实现双向绑定的缺陷;
2020-11-24 17:00:16 +08:00
Argo-Cloud
88254c9ec7 release: 发布新版本 5.0.4-beta01 2020-11-23 11:48:50 +08:00
Argo
0775356b90 !678 feat(#I26JBE): DateTimePicker 组件此刻按钮优化
* feat: 点击此刻按钮时直接返回值并且关闭弹窗
2020-11-23 11:42:31 +08:00
Argo
5005d2c00e !677 feat(#I26GWQ): 修复 Table 组件时间未设置格式化时默认根据文化设置显示
* fix: 修复 Centos 时间日期格式不正确问题
2020-11-22 16:34:48 +08:00
Argo
49c49d7549 !676 feat(#I26GID): DateTimePickerBody 组件增加 ShotFooter 属性控制是否显示按钮行
* doc: DateTimeBody 更新 ShowFooter 示例
* feat: DatePickerBody 增加 ShowFooter 属性
* refactor: 重构侧边栏显示逻辑
2020-11-22 12:19:08 +08:00
Argo
286eea7384 !675 feat(#I26DQF): DatetimePicker 组件增加快捷侧边栏功能
* style: 增加侧边栏鼠标悬停样式
* feat: 侧边栏快捷方式点击后直接关闭弹窗
* feat: 增加资源文件
* doc: 修复时间显示格式采用 24 小时格式
* refactor: 移除 form-group 样式
* doc: 增加侧边栏示例
* doc: 增加 wrapper 限制宽度
* feat: 组件增加侧边栏是否显示属性
* feat: Body 增加侧边栏是否显示属性
* style: 微调样式适配组件侧边栏
* refactor: 重构 DatePickerCell 代码
* doc: 微调资源文件描述文字
2020-11-21 15:31:43 +08:00
Argo-Cloud
665ae81352 release: 发布新版本 5.0.3 2020-11-21 01:03:16 +08:00
Argo
1dfd30849f !674 feat(#I26CK0): 弹窗基类增加 ForceDelay 参数防止被全局配置覆盖
* feat: 增加 ForceDelay 属性防止被全局配置覆盖
2020-11-21 01:02:36 +08:00
Argo
c0f62879c5 !673 doc(#I264OZ): 更新文档关于统一设置 Toast 组件延时消失时间参数
* doc: 更新 Toast 组件统一配置 Delay 参数文档
* doc: 格式化文档
* doc: 增加 HostFile 参数完善 ssr wasm 文件名
* doc: wasm 模式增加弹出框组件延时配置示例
* doc: 更新英文版 readme
2020-11-21 00:56:50 +08:00
Argo
bf2b680f2e !672 feat(#I26CI5): 演示网站增加 WebsiteOptions 配置类用于统一设置域名链接地址
* doc: 更新图床地址
* doc: 使用 WebsiteOptions 配置类网址
* feat: 增加 WebsiteOptions 注入配置类
* doc: 更新菜单栏链接地址
* doc: 格式化文档
2020-11-20 23:50:35 +08:00
Argo
e2ff4b988b !671 feat(#I26CFD): 增加 BootstrapBlazorOptions 全局配置类
* feat: 增加对 BootstrapBlazorOptions 支持
* doc: 更新配置文件
* feat: 增加 BootstrapBlazorOptions 配置项
* revert: 恢复 PopupOptionBase Delay 属性值
* feat: 增加 ToastOption 配置信息
* feat: ToastOption 读取配置设置的 Delay 参数
* feat: Toast 组件增加自动隐藏时间设置配置项
* doc: 移除 form-group 样式
2020-11-20 22:24:23 +08:00
Argo-Cloud
94bc25b9e0 doc: 更新 readme.md 文件 2020-11-20 00:03:27 +08:00
Argo
878f39dfe2 !670 doc(#I25JPT): 更新文档增加按钮二次封装例子
* doc: 增加按钮二次开发示例
2020-11-19 22:04:14 +08:00
Argo
280c418b36 !669 feat(#I265FS): 增加页脚网站备案信息
* feat: 增加页脚
* refactor: 更新文化选择脚本
2020-11-19 16:24:05 +08:00
Argo-Cloud
22d0454394 release: 发布新版本 5.0.3-beta05 2020-11-19 12:31:58 +08:00
Argo
b105aa182f !668 feat(#I263VK): Scroll 组件增加 IsForce 属性适配移动端与 Mac 系统
* doc: 更新 Scroll 文档增加 IsForce 属性
* refactor: 更新打包脚本
* refactor: 侧边栏滚动条适配移动端与 mac 系统
* refactor: scroll 组件增加 IsForce 属性用于适配移动端
2020-11-19 12:30:34 +08:00
Argo
cad500709d !667 fix(#I263ES): 修复安卓机型无法展开侧边栏问题
* scripts: 更新脚本
* refactor: 增加苹果电脑适配
* scripts: 更新 scroll 脚本
* style: 移除 Scroll 组件样式
* refactor: Scroll 组件代码
2020-11-19 11:11:32 +08:00
Argo-Cloud
289fa6bade refactor: 更新网站域名 2020-11-19 10:14:35 +08:00
Argo-Cloud
3243b766ee doc: 更新域名挂件 2020-11-18 22:23:18 +08:00
Argo-Cloud
906a79530f doc: 更新 readme 文件增加新域名 www.blazor.zone 2020-11-18 22:21:30 +08:00
Argo
0db8535380 !666 feat(#I25QNN): 增加中文繁体资源文件
* feat: 增加中文繁体资源文件
2020-11-17 12:43:09 +08:00
Argo-Cloud
0c863c76de release: 发布新版本 5.0.3-beta04 2020-11-16 18:05:30 +08:00
Argo
1905f0a64f !665 feat(#I25MVM): wasm 模式 NET5.0 下支持本地化功能
* refactor: 格式化 wasm 模式多语言显示文字
* feat: wasm 模式默认语言文化信息为当前文化信息
* feat: wasm 模式增加多语言支持
2020-11-16 18:04:20 +08:00
Argo
454eb537f5 !664 refactor(#I25MNA): 消除 bootstrap.bundle.js.map 警告信息
* refactor: 移除 bootstrap.bundle.js.map 的引用
2020-11-16 17:35:12 +08:00
Argo-Cloud
6eab3e6d73 release: 发布新版本 5.0.3-beta03 2020-11-16 10:38:11 +08:00
Argo
f8e85675af !663 revert(#I25IQM): 移除样式隔离功能提供性能
* feat: bundleconfig移除 import 脚本
* revert: Toast 组件移除样式隔离
* revert: Toast 组件移除样式隔离功能
* revert: Toast 组件移除样式隔离
* revert: Timer 组件移除样式隔离功能
* revert: Swal 组件移除样式隔离功能
* revert: MultiSelect 组件移除样式隔离
* revert: QRCode 组件移除样式隔离功能
* revert: Pagination 组件样式隔离功能移除
* revert: Light 组件样式隔离功能移除
* revert: Camera 组件移除样式隔离功能
* refactor: Alert 样式隔离功能移除
2020-11-16 10:36:35 +08:00
Argo
e2fec6c850 !662 revert(#I25HJK): 移除 Calendar 组件样式隔离功能
* revert: Calendar 样式隔离功能移除
2020-11-16 00:42:33 +08:00
Argo-Cloud
6d751c6a5d release: 发布新版本 5.0.3-beta02 2020-11-15 23:56:21 +08:00
Argo
e985d6f52e !661 feat(#I25HIS): Calendar 组件支持本地化
* feat: Calendar 组件支持本地化
* doc: 增加 Calendar 资源文件
2020-11-15 23:55:25 +08:00
Argo
f0056aa3e2 !660 feat(#I25H5G): Calendar 组件支持样式隔离
* refactor: 移除 BuildBundlerMinifier 依赖
* feat: Calendar 组件支持样式隔离功能
* doc: 更新明细行功能文档增加 ShowDetailRow 说明
2020-11-15 20:05:34 +08:00
Argo
f7dc9df951 !659 feat(#I258J2): Pagination 增加样式隔离功能
* style: Pagination 组件增加样式隔离功能
* refactor: 移除 PaginationItem 组件
2020-11-15 00:29:59 +08:00
Argo
9059656252 !658 feat(#I25874): Light 组件增加样式隔离
* refactor: Light 组件增加样式隔离功能
2020-11-14 20:38:30 +08:00
Argo Zhang
97338dccbe release: 发布新版本 5.0.3-beta01 2020-11-14 19:45:38 +08:00
Argo
c4a3757ba1 !657 fix(#I250JC): 修复 MultiSelect 组件双向绑定值无法更新问题
* doc: 更新示例代码文件
* doc: 增加双向绑定示例
* fix: 修复 MultiSelect 组件双向绑定值无法更新问题
2020-11-14 19:36:16 +08:00
Argo
c064b8c469 !656 feat(#I2581T): 部分组件增加样式隔离功能
* release: 发布新版本 5.0.2-beta01
* refactor: Toast 组件增加样式隔离功能
* doc: 输出程序集排除 import.min.css 文件
* MultiSelect 组件增加样式隔离功能
* feat: Camera 组件增加样式隔离功能
* feat: QRCode 增加样式隔离功能
* feat: Timer 组件进行样式隔离
* feat: Swal 组件支持样式隔离功能
2020-11-14 18:36:53 +08:00
Argo
5aa7f34504 !655 feat(#I253B0): Toggle 组件增加样式隔离
* feat: Toggle 组件增加样式隔离功能
2020-11-13 13:21:19 +08:00
Argo
3a084e500f !654 feat(#I2532G): Alert 组件增加样式隔离功能
* refactor: Alert 组件增加样式隔离功能
* feat: 增加样式隔离功能
* style: 微调侧边栏菜单右侧 badge 间隙
2020-11-13 13:01:14 +08:00
Argo
ee3aadb3bb !653 feat(#I2506K): 样式文件打包捆绑
* release: 发布新版本 5.0.2
* release: 发布新版本 5.0.2-beta01
* build: 调整打包资源文件
* doc: 更正样式文件
* refactor: 更新引用样式文件
* style: 样式打包 输出 bootstrap.blazor.bundle.min.css
* refactor: 移除 css 的导入
2020-11-12 21:46:16 +08:00
Argo
4b516e5814 !652 fix(#I24XQU): 修复 Table 无法弹窗问题
* refactor: 更新项目文件增加浏览器支持
* scripts: 更新 CI&CD 脚本
* release: 发布新版本 5.0.1
* refactor: OnSaveAsync 方法增加 NotNull 标签
* refactor: 移除 OnInitializedAsync 方法
2020-11-12 14:57:36 +08:00
Argo
5d7e185586 !651 release(#I24WR8): Blazor 扩展组件更新到 net 5.0
* refactor: Table Export 导出组件升级为 net 5.0
* refactor: Markdown 组件升级到 5.0
* refactor: Chart 组件升级到 5.0
2020-11-12 11:55:03 +08:00
Argo
13e6eb555e !650 release(#I24WCP): 发布新版本 5.0.0
* release: 发布新版本 5.0.0
* refactor: 精简 nuget 包大小
2020-11-12 11:10:09 +08:00
Argo
2cf798a4c9 !649 release(#I24W44): Blazor 扩展组件更新到 netcore 3.1 最新版 2020-11-12 10:48:06 +08:00
Argo
50d8cf759f !648 refactor(#I24W2Y): 消除升级 net5.0 后带来的警告信息 2020-11-12 10:43:57 +08:00
Argo
dfe824fc02 !647 build(#I24SVG): 升级到 net5.0
* release: 发布新版本 5.0.0-beta01
* refactor: 更新 action 编译环境为 5.0.100
* test: 单元测试更新到 net5.0
* build: server 模式更新到 net5.0
* build: wasm 模式更新到 net5.0
* refactor: 项目文件增加 SupportedPlatform 小节
* build: Server 工程升级到 5.0
* build: Shared 工程升级到 net5.0
* build: Doc 工程升级到 net5.0
* refactor: 移除过期方法
* build: BootstrapBlazor 升级到 5.0
2020-11-11 16:06:36 +08:00
170 changed files with 3664 additions and 1569 deletions

View File

@@ -11,6 +11,7 @@ indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
[*.{cs,css,js,json,html,razor}]
charset = utf-8-bom
[*.{json,yml,xml}]
indent_size = 2

View File

@@ -3,8 +3,9 @@ name: Deploy To Huawei VM
on:
push:
branches:
- master
- dev
- dev-ci
- hot-fix
jobs:
deploy:

View File

@@ -5,6 +5,7 @@ on:
branches:
- master
- dev
- hot-fix
jobs:
pack:
@@ -16,7 +17,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.403
dotnet-version: 5.0.100
- name: Publish to Nuget
env:

View File

@@ -5,6 +5,7 @@ on:
branches:
- master
- dev
- hot-fix
jobs:
publish:
@@ -16,7 +17,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.402
dotnet-version: 5.0.100
- name: Publish wasm
run: |

View File

@@ -27,8 +27,8 @@ English | <a href="README.zh-CN.md">中文</a>
- Seamless integration with existing ASP.NET Core MVC and Razor Pages projects.
## Online Examples
[![website](https://img.shields.io/badge/China-http://blazor.sdgxgz.com-success.svg?color=red&logo=buzzfeed&logoColor=red)](https://blazor.sdgxgz.com)
[![website](https://img.shields.io/badge/Github-http://argozhang.github.io-success.svg?logo=buzzfeed&logoColor=green)](https://argozhang.github.io)
[![website](https://img.shields.io/badge/China-https://www.blazor.zone-success.svg?color=red&logo=buzzfeed&logoColor=red)](https://www.blazor.zone)
[![website](https://img.shields.io/badge/Github-https://argozhang.github.io-success.svg?logo=buzzfeed&logoColor=green)](https://argozhang.github.io)
## Installation Guide
@@ -51,7 +51,7 @@ English | <a href="README.zh-CN.md">中文</a>
`dotnet add package BootstrapBlazor`
2. **Add** the `stylesheet` `javascripts` file to your main index file - `~/Pages/_Host.cshtml`
2. **Add** the `stylesheet` `javascripts` file to your main index file - `Pages/_Host.cshtml (Server)` or `wwwroot/index.html (WebAssembly)`
**HTML**
@@ -60,7 +60,7 @@ English | <a href="README.zh-CN.md">中文</a>
<html lang="en">
<head>
. . .
<link rel="stylesheet" href="_content/BootstrapBlazor.Chart/css/bootstrap.blazor.chart.bundle.min.css">
<link rel="stylesheet" href="_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css">
</head>
<body>
. . .

View File

@@ -34,7 +34,7 @@ Blazor应用基于组件。 Blazor 中的组件是指 UI 元素,例如页面
### 内置组件
内置组件 [传送门](http://blazor.sdgxgz.com/alerts)
内置组件 [传送门](https://www.balzor.zone/alerts)
## 分支说明
@@ -44,7 +44,8 @@ Blazor应用基于组件。 Blazor 中的组件是指 UI 元素,例如页面
- 其他 均为临时分支
## 演示地址
[![website](https://img.shields.io/badge/linux-http://blazor.sdgxgz.com-success.svg?logo=buzzfeed&logoColor=green)](http://blazor.sdgxgz.com)
[![website](https://img.shields.io/badge/linux-https://www.blazor.zone-success.svg?logo=buzzfeed&logoColor=green)](https://www.blazor.zone)
[![website](https://img.shields.io/badge/Github-https://argozhang.github.io-success.svg?logo=buzzfeed&logoColor=red&color=red)](https://argozhang.github.io)
## 项目截图

View File

@@ -1,17 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<OutputType>Library</OutputType>
<RazorLangVersion>3.0</RazorLangVersion>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>true</IsPackable>
<PackageIcon>logo.png</PackageIcon>
<Version>3.1.1</Version>
<Version>5.0.0</Version>
<PackageReleaseNotes>更新日志https://gitee.com/LongbowEnterprise/BootstrapBlazor/wikis</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="3.1.28" />
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
@@ -21,7 +23,19 @@
<ItemGroup>
<Content Remove="bundleconfig.json" />
<Content Remove="wwwroot\css\bootstrap.blazor.chart.css" />
<Content Remove="wwwroot\css\Chart.*" />
<Content Remove="wwwroot\js\bootstrap.blazor.chart.js" />
<Content Remove="wwwroot\js\bootstrap.blazor.chart.min.js" />
<Content Remove="wwwroot\js\Chart.bundle.js" />
<Content Remove="wwwroot\js\Chart.bundle.min.js" />
<None Include="bundleconfig.json" />
<None Include="wwwroot\css\bootstrap.blazor.chart.css" />
<None Include="wwwroot\css\Chart.*" />
<None Include="wwwroot\js\bootstrap.blazor.chart.js" />
<None Include="wwwroot\js\bootstrap.blazor.chart.min.js" />
<None Include="wwwroot\js\Chart.bundle.js" />
<None Include="wwwroot\js\Chart.bundle.min.js" />
</ItemGroup>
<ItemGroup>

View File

@@ -0,0 +1,5 @@
{
"Components.Chart": {
"LoadingText": "Laden ..."
}
}

View File

@@ -1,9 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<OutputType>Library</OutputType>
<RazorLangVersion>3.0</RazorLangVersion>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,14 @@
<WinButton Text="按钮一" OnClick="@ClickButtonShowText"></WinButton>
<WinButton Text="按钮二" OnClick="@ClickButtonShowText"></WinButton>
<div>@ButtonText</div>
@code {
private string ButtonText { get; set; } = "";
private Task ClickButtonShowText(string text)
{
ButtonText = text;
StateHasChanged();
return Task.CompletedTask;
}
}

View File

@@ -1,4 +1,4 @@
<DatePickerBody IsShown="true" ValueChanged="@DateValueChanged" />
<DatePickerBody IsShown="true" ValueChanged="@DateValueChanged" ShowFooter="false" />
@code {
/// <summary>

View File

@@ -0,0 +1,2 @@
<DateTimePicker TValue="DateTime" ViewModel="DatePickerViewModel.Date" Value="@(DateTime.Today.AddDays(3 - DateTime.Today.Day))"
MinValue="@(DateTime.Today.AddDays(1 - DateTime.Today.Day))" MaxValue="@(DateTime.Today.AddDays(14 - DateTime.Today.Day))" />

View File

@@ -0,0 +1 @@
<DateTimePicker TValue="DateTime" ShowSidebar="true" ViewModel="DatePickerViewModel.DateTime"/>

View File

@@ -0,0 +1,15 @@
<DateTimeRange @bind-Value="@DateTimeRangeValue1" OnConfirm="OnConfirm" />
<Logger @ref="DateLogger" class="mt-3" />
@code {
[NotNull]
private Logger? DateLogger { get; set; }
private DateTimeRangeValue DateTimeRangeValue1 { get; set; } = new DateTimeRangeValue();
private Task OnConfirm(DateTimeRangeValue value)
{
DateLogger?.Log($"选择的时间范围是: {value.Start:yyyy-MM-dd} - {value.End:yyyy-MM-dd}");
return Task.CompletedTask;
}
}

View File

@@ -0,0 +1,15 @@
<DateTimeRange @bind-Value="@DateTimeRangeValue2" />
<div>
@if (DateTimeRangeValue2.Start != DateTime.MinValue)
{
<span>时间范围:</span> @DateTimeRangeValue2.Start.ToString("yyyy-MM-dd");
}
@if (DateTimeRangeValue2.End != DateTime.MinValue)
{
<span> - </span> @DateTimeRangeValue2.End.ToString("yyyy-MM-dd");
}
</div>
@code {
private DateTimeRangeValue DateTimeRangeValue2 { get; set; } = new DateTimeRangeValue();
}

View File

@@ -0,0 +1,5 @@
<DateTimeRange Value="@DateTimeRangeValue3" IsDisabled="true" />
@code {
private DateTimeRangeValue DateTimeRangeValue3 { get; set; } = new DateTimeRangeValue() { Start = DateTime.Today, End = DateTime.Today.AddDays(3) };
}

View File

@@ -1 +1 @@
<link rel="stylesheet" href="_content/BootstrapBlazor/css/bootstrap.blazor.min.css">
<link rel="stylesheet" href="_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css">

View File

@@ -1,7 +1,7 @@
@inherits LayoutComponentBase
<Layout SideWidth="0" IsPage="true" IsFullSide="@IsFullSide" IsFixedHeader="@IsFixedHeader" IsFixedFooter="@IsFixedFooter"
ShowFooter="@ShowFooter" ShowGotoTop="true" ShowCollapseBar="true" OnCollapsed="@OnCollapsed" Menus="@GetIconSideMenuItems()">
ShowFooter="@ShowFooter" ShowGotoTop="true" ShowCollapseBar="true" OnCollapsed="@OnCollapsed" Menus="@Menus">
<Header>
<span class="ml-3 flex-fill">Bootstrap of Blazor</span>
<img src="_content/BootstrapBlazor.Shared/images/Argo.png" class="layout-avatar-right" />

View File

@@ -15,6 +15,15 @@ namespace BootstrapBlazor.Shared.Pages
/// </summary>
public bool IsCollapsed { get; set; }
private IEnumerable<MenuItem> Menus { get; set; }
protected override void OnInitialized()
{
base.OnInitialized();
Menus = GetIconSideMenuItems();
}
private Task OnCollapsed(bool collapsed)
{
IsCollapsed = collapsed;

View File

@@ -34,7 +34,7 @@
Products = Enumerable.Range(1, 20).Select(i => new Product()
{
ImageUrl = $"https://imgs.sdgxgz.com/images/Pic{i}.jpg",
ImageUrl = $"https://imgs.blazor.zone/images/Pic{i}.jpg",
Description = $"Pic{i}.jpg"
});
}

View File

@@ -29,7 +29,7 @@
Products = Enumerable.Range(1, 100).Select(i => new Product()
{
ImageUrl = $"https://imgs.sdgxgz.com/images/Pic{i}.jpg",
ImageUrl = $"https://imgs.blazor.zone/images/Pic{i}.jpg",
Description = $"Pic{i}.jpg"
});
}

View File

@@ -29,7 +29,7 @@
Products = Enumerable.Range(1, 100).Select(i => new Product()
{
ImageUrl = $"https://imgs.sdgxgz.com/images/Pic{i}.jpg",
ImageUrl = $"https://imgs.blazor.zone/images/Pic{i}.jpg",
Description = $"Pic{i}.jpg"
});
}

View File

@@ -1,4 +1,6 @@
<MultiSelect Items="@Items" @bind-Value="@SelectedItemsValue"></MultiSelect>
<Button Icon="fa fa-plus" Text="添加" OnClick="@AddItems" class="mr-1"></Button>
<Button Icon="fa fa-minus" Text="减少" OnClick="@RemoveItems"></Button>
@code {
/// <summary>
@@ -18,4 +20,14 @@
};
private string SelectedItemsValue { get; set; } = "Beijing,Chengdu";
private void AddItems()
{
SelectedItemsValue = "Beijing,Chengdu,Hangzhou,Lianyungang";
}
private void RemoveItems()
{
SelectedItemsValue = "Beijing,Chengdu";
}
}

View File

@@ -1,4 +1,6 @@
<MultiSelect Items="@Items" @bind-Value="@SelectedArrayValues"></MultiSelect>
<Button Icon="fa fa-plus" Text="添加" OnClick="@AddListItems" class="mr-1"></Button>
<Button Icon="fa fa-minus" Text="减少" OnClick="@RemoveListItems"></Button>
@code {
/// <summary>
@@ -18,4 +20,14 @@
};
private IEnumerable<string> SelectedArrayValues { get; set; } = Enumerable.Empty<string>();
private void AddListItems()
{
SelectedArrayValues = "Beijing,Chengdu,Hangzhou,Lianyungang".Split(',');
}
private void RemoveListItems()
{
SelectedArrayValues = "Beijing,Chengdu".Split(',');
}
}

View File

@@ -0,0 +1,2 @@
<Rate Value="@BindValue1" IsDisable="IsDisable" />
<Switch @bind-Value="IsDisable" OnText="禁用" OnColor="Color.Danger" OffText="启用" OffColor="@Color.Success" />

View File

@@ -1,22 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<OutputType>Library</OutputType>
<RazorLangVersion>3.0</RazorLangVersion>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>true</IsPackable>
<PackageIcon>logo.png</PackageIcon>
<Version>3.1.1</Version>
<Version>5.0.0</Version>
<PackageReleaseNotes>更新日志https://gitee.com/LongbowEnterprise/BootstrapBlazor/wikis</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="3.1.28" />
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<Content Remove="bundleconfig.json" />
<Content Remove="wwwroot\lib\editor.md\*.*" />
<None Include="bundleconfig.json" />
<None Include="wwwroot\lib\editor.md\*.*" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,10 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsWebProject>true</IsWebProject>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Longbow.Tasks" Version="3.1.1" />
</ItemGroup>

View File

@@ -1,4 +1,5 @@
using BootstrapBlazor.Shared.Data;
using BootstrapBlazor.Shared;
using BootstrapBlazor.Shared.Data;
using Longbow.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
@@ -31,6 +32,7 @@ namespace Microsoft.Extensions.DependencyInjection
});
services.AddVersionManager();
services.AddExampleService();
services.AddSingleton<WebsiteOptions>();
services.AddHostedService<BlazorBackgroundServices>();
return services;
}

View File

@@ -20,7 +20,7 @@
<base href="~/">
<link rel="stylesheet" href="_content/BootstrapBlazor.Chart/css/bootstrap.blazor.chart.bundle.min.css">
<link rel="stylesheet" href="_content/BootstrapBlazor.Markdown/css/bootstrap.blazor.markdown.min.css">
<link rel="stylesheet" href="_content/BootstrapBlazor/css/bootstrap.blazor.min.css">
<link rel="stylesheet" href="_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css">
<link rel="stylesheet" href="_content/BootstrapBlazor.Shared/lib/highlight/vs.css">
<link rel="stylesheet" href="_content/BootstrapBlazor.Shared/css/site.css">
</head>

View File

@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Builder;
using BootstrapBlazor.Components;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Localization;
@@ -61,6 +62,12 @@ namespace BootstrapBlazor.Server
// 增加 Table Excel 导出服务
services.AddBootstrapBlazorTableExcelExport();
// 统一设置 Toast 组件自动消失时间
services.Configure<BootstrapBlazorOptions>(options =>
{
options.ToastDelay = 4000;
});
// 增加多语言支持配置信息
services.Configure<RequestLocalizationOptions>(options =>
{
@@ -80,7 +87,7 @@ namespace BootstrapBlazor.Server
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// 启用本地化
app.UseRequestLocalization(app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>().Value);
app.UseRequestLocalization(app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>()!.Value);
app.UseForwardedHeaders(new ForwardedHeadersOptions() { ForwardedHeaders = ForwardedHeaders.All });

View File

@@ -1,4 +1,4 @@
{
"DetailedErrors": true,
"PathBase": "http://blazor.sdgxgz.com/"
"DetailedErrors": false,
"PathBase": "http://admin.blazor.zone/"
}

View File

@@ -9,6 +9,13 @@
"AllowedHosts": "*",
"SupportCultures": [
"en-US",
"zh-CN"
]
"de-DE",
"zh-CN",
"zh-TW"
],
"BootstrapBlazorOptions": {
"ToastDelay": 4000,
"MessageDelay": 4000,
"SwalDelay": 4000
}
}

View File

@@ -1,18 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<OutputType>Library</OutputType>
<RazorLangVersion>3.0</RazorLangVersion>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>true</IsPackable>
<Version>3.1.0</Version>
<Version>5.0.0</Version>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor.Chart" Version="3.1.1" />
<PackageReference Include="BootstrapBlazor.Markdown" Version="3.1.1" />
<PackageReference Include="BootstrapBlazor.TableExport" Version="3.1.1" />
<PackageReference Include="System.Net.Http.Json" Version="3.2.1" />
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -25,7 +25,9 @@ namespace Microsoft.Extensions.DependencyInjection
ret = new List<string>()
{
"en-US",
"zh-CN"
"de-DE",
"zh-CN",
"zh-TW"
};
}

View File

@@ -71,7 +71,7 @@ namespace Microsoft.Extensions.DependencyInjection
{
var url = $"https://azuresearch-usnc.nuget.org/query?q={packageName}&prerelease=true&semVerLevel=2.0.0";
var package = await Client.GetFromJsonAsync<NugetPackage>(url);
Version = package.GetVersion();
if (package != null) Version = package.GetVersion();
}
catch { }
}
@@ -82,7 +82,7 @@ namespace Microsoft.Extensions.DependencyInjection
/// <summary>
/// Data 数据集合
/// </summary>
public IEnumerable<NugetPackageData> Data { get; set; } = new NugetPackageData[0];
public IEnumerable<NugetPackageData> Data { get; set; } = Array.Empty<NugetPackageData>();
/// <summary>
///

View File

@@ -0,0 +1,28 @@
namespace BootstrapBlazor.Shared
{
/// <summary>
///
/// </summary>
public class WebsiteOptions
{
/// <summary>
///
/// </summary>
public string ServerUrl { get; set; } = "https://www.blazor.zone";
/// <summary>
///
/// </summary>
public string WasmUrl { get; set; } = "https://wasm.blazor.zone";
/// <summary>
///
/// </summary>
public string AdminUrl { get; set; } = "https://admin.blazor.zone";
/// <summary>
///
/// </summary>
public string ImageLibUrl { get; set; } = "https://imgs.blazor.zone";
}
}

View File

@@ -138,6 +138,22 @@
</div>
</Block>
<Block Title="二次封装按钮" Introduction="通过设置 <code>WinButton</code> 组件的 <code>Text</code> 属性对按钮显示文字进行设置,点击按钮是右侧显示被点击按钮的文字" CodeFile="button.8.html">
<div class="form-inline">
<div class="row">
<div class="form-group col-auto">
<WinButton Text="按钮一" OnClick="@ClickButtonShowText"></WinButton>
</div>
<div class="form-group col-auto">
<WinButton Text="按钮二" OnClick="@ClickButtonShowText"></WinButton>
</div>
<div class="form-group col-auto">
@ButtonText
</div>
</div>
</div>
</Block>
<AttributeTable Items="@GetAttributes()" />
<EventTable Items="@GetEvents()" />

View File

@@ -3,6 +3,7 @@ using BootstrapBlazor.Shared.Common;
using BootstrapBlazor.Shared.Pages.Components;
using Microsoft.AspNetCore.Components.Web;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
namespace BootstrapBlazor.Shared.Pages
@@ -17,9 +18,8 @@ namespace BootstrapBlazor.Shared.Pages
/// </summary>
private Logger? Trace { get; set; }
#nullable disable
private Button ButtonDisableDemo { get; set; }
#nullable restore
[NotNull]
private Button? ButtonDisableDemo { get; set; }
private bool IsDisable { get; set; }
@@ -45,6 +45,15 @@ namespace BootstrapBlazor.Shared.Pages
Trace?.Log($"Button Clicked");
}
private string ButtonText { get; set; } = "";
private Task ClickButtonShowText(string text)
{
ButtonText = text;
StateHasChanged();
return Task.CompletedTask;
}
/// <summary>
/// 获得事件方法
/// </summary>

View File

@@ -12,7 +12,7 @@
<Options>
@foreach (var kv in Configuration.GetSupportCultures())
{
<SelectOption Text="@kv.NativeName" Value="@kv.Name" />
<SelectOption Text="@GetDisplayName(kv)" Value="@kv.Name" />
}
</Options>
</Select>
@@ -45,7 +45,7 @@
var cultureName = item.Value;
if (cultureName != CultureInfo.CurrentCulture.Name)
{
await JSRuntime.InvokeAsync<string>(identifier: "$.blazorCulture.set", cultureName);
await JSRuntime.InvokeVoidAsync(identifier: "$.blazorCulture.set", cultureName);
var culture = new CultureInfo(cultureName);
CultureInfo.CurrentCulture = culture;
CultureInfo.CurrentUICulture = culture;
@@ -54,4 +54,20 @@
}
}
}
private string GetDisplayName(CultureInfo culture)
{
return CultureStorage.Mode switch
{
CultureStorageMode.Webapi => culture.NativeName,
_ => culture.Name switch
{
"zh-CN" => "中文(中国)",
"zh-TW" => "中文(台灣)",
"en-US" => "English (United States)",
"de-DE" => "Deutsch (Deutschland)",
_ => ""
}
};
}
}

View File

@@ -42,6 +42,7 @@
private BindItem? Model { get; set; }
[System.Diagnostics.CodeAnalysis.NotNull]
private List<BindItem>? Items { get; set; }
private static readonly Random random = new Random();

View File

@@ -12,7 +12,7 @@
<h4>CSS 文件</h4>
<p>将 Bootstrap 的 CSS 文件以 <code>&lt;link&gt;</code> 标签的形式添加到 <code>&lt;head&gt;</code> 标签中,并放置在所有其它样式表之前。</p>
<p>将 Bootstrap 的 CSS 文件以 <code>&lt;link&gt;</code> 标签的形式添加到 <code>@HostFile</code> 文件 <code>&lt;head&gt;</code> 标签中,并放置在所有其它样式表之前。</p>
<Pre CodeFile="install.1.html"></Pre>
@@ -23,7 +23,7 @@
<h4>JS 文件</h4>
<p>Bootstrap 所提供的许多组件都依赖 JavaScript 才能运行。具体来说,这些组件都依赖 jQuery、Popper.js 以及我们自己的 JavaScript 插件。将以下 <code>&lt;script&gt;</code> 标签放到页面尾部且在 <code>&lt;/body&gt;</code> 标签之前即可起作用。</p>
<p>Bootstrap 所提供的许多组件都依赖 JavaScript 才能运行。具体来说,这些组件都依赖 jQuery、Popper.js 以及我们自己的 JavaScript 插件。将以下 <code>&lt;script&gt;</code> 标签放到 <code>>@HostFile</code> 文件尾部且在 <code>&lt;/body&gt;</code> 标签之前即可起作用。</p>
<Pre CodeFile="install.2.html"></Pre>
<h4>添加命名空间到 <code>_Imports.razor</code> 文件</h4>

View File

@@ -19,6 +19,12 @@ namespace BootstrapBlazor.Shared.Pages.Components
[Parameter]
public string Title { get; set; } = "服务器端渲染模式";
/// <summary>
///
/// </summary>
[Parameter]
public string HostFile { get; set; } = "Pages/_Host.cshtml";
/// <summary>
///
/// </summary>

View File

@@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.JSInterop;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
namespace BootstrapBlazor.Shared.Pages.Components
@@ -13,7 +14,7 @@ namespace BootstrapBlazor.Shared.Pages.Components
/// </summary>
public sealed partial class Pre
{
private ElementReference? PreElement { get; set; }
private ElementReference PreElement { get; set; }
/// <summary>
/// 获得 样式集合
@@ -30,6 +31,7 @@ namespace BootstrapBlazor.Shared.Pages.Components
/// 获得/设置 IJSRuntime 实例
/// </summary>
[Inject]
[NotNull]
private IJSRuntime? JSRuntime { get; set; }
/// <summary>
@@ -71,9 +73,9 @@ namespace BootstrapBlazor.Shared.Pages.Components
/// OnAfterRender 方法
/// </summary>
/// <param name="firstRender"></param>
protected override void OnAfterRender(bool firstRender)
protected override async Task OnAfterRenderAsync(bool firstRender)
{
JSRuntime.InvokeVoidAsync("$.highlight", PreElement);
await JSRuntime.InvokeVoidAsync("$.highlight", PreElement);
}
private async Task ReloadExampleCodeAsync()

View File

@@ -0,0 +1,18 @@
@if (Count > 0)
{
<Badge Color="@BootstrapBlazor.Components.Color.Info" IsPill="true">
@Count
</Badge>
}
@if (IsNew)
{
<span class="badge badge-danger">
<span>NEW</span>
</span>
}
@if (IsUpdate)
{
<span class="badge badge-success">
<span>Upd</span>
</span>
}

View File

@@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Components;
namespace BootstrapBlazor.Shared.Pages.Components
{
/// <summary>
///
/// </summary>
public sealed partial class State
{
/// <summary>
/// 获得/设置 是否为新组件 默认为 false
/// </summary>
[Parameter]
public bool IsNew { get; set; }
/// <summary>
/// 获得/设置 是否为更新功能 默认为 false
/// </summary>
[Parameter]
public bool IsUpdate { get; set; }
/// <summary>
/// 获得/设置 组件数量
/// </summary>
[Parameter]
public int Count { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
<Button Text="@Text" OnClick="@(e => OnClick(Text))" />
@code {
[Parameter]
public string Text { get; set; } = "Test";
[Parameter]
public Func<string, Task> OnClick { get; set; } = _ => Task.CompletedTask;
}

View File

@@ -5,8 +5,9 @@
<h4>用于选择或输入日期</h4>
<Block Title="选择日" Introduction="以「日」为基本单位,基础的日期选择控件" CodeFile="datepicker.1.html">
<DatePickerBody IsShown="true" ValueChanged="@DateValueChanged" />
<div style="width: 320px;">
<DatePickerBody IsShown="true" ValueChanged="@DateValueChanged" ShowFooter="false" />
</div>
<Logger @ref="DateLogger" class="mt-3" />
</Block>
@@ -105,13 +106,34 @@
<Block Title="禁用" Introduction="设置 <code>IsDisabled</code> 属性值为 <code>true</code> 时,组件禁止输入" CodeFile="datepicker.8.html">
<div class="form-inline">
<div class="row">
<div class="form-group col-12">
<div class="col-12">
<DateTimePicker TValue="DateTime" IsDisabled="true" />
</div>
</div>
</div>
</Block>
<Block Title="带快捷键侧边栏" Introduction="设置 <code>ShowSidebar</code> 属性值为 <code>true</code> 时,组件显示快捷方式侧边栏" CodeFile="datepicker.9.html">
<div class="form-inline">
<div class="row">
<div class="col-12">
<DateTimePicker TValue="DateTime" ShowSidebar="true" ViewModel="DatePickerViewModel.DateTime" />
</div>
</div>
</div>
</Block>
<Block Title="设置值范围" Introduction="设置 <code>MinValue</code> 属性值与 <code>MaxValue</code> 限制可选值范围" CodeFile="datepicker.10.html">
<div class="form-inline">
<div class="row">
<div class="col-12">
<DateTimePicker TValue="DateTime" ViewModel="DatePickerViewModel.Date" Value="@(DateTime.Today.AddDays(3 - DateTime.Today.Day))"
MinValue="@(DateTime.Today.AddDays(1 - DateTime.Today.Day))" MaxValue="@(DateTime.Today.AddDays(14 - DateTime.Today.Day))" />
</div>
</div>
</div>
</Block>
<AttributeTable Items="@GetAttributes()" />
<EventTable Items="@GetEvents()" />

View File

@@ -147,6 +147,13 @@ namespace BootstrapBlazor.Shared.Pages
ValueList = "true|false",
DefaultValue = "true"
},
new AttributeItem() {
Name = "ShowSidebar",
Description = "是否显示快捷侧边栏",
Type = "bool",
ValueList = "true|false",
DefaultValue = "false"
},
new AttributeItem() {
Name = "DisplayText",
Description = "前置标签显示文本",

View File

@@ -0,0 +1,44 @@
@page "/datetimeranges"
<h3>DateTimeRange 日期时间段选择器</h3>
<h4>在同一个选择器里选择一段日期</h4>
<Block Title="基本功能" Introduction="以「日」为基本单位,选择一段时间" CodeFile="datetimerange.1.html">
<DateTimeRange @bind-Value="@DateTimeRangeValue1" OnConfirm="OnConfirm" />
<Logger @ref="DateLogger" class="mt-3" />
</Block>
<Block Title="数据双向绑定" Introduction="点击确认按钮时间选择框值与文本框值一致" CodeFile="datetimerange.2.html">
<div class="form-inline">
<div class="row">
<div class="form-group col-12 col-sm-6">
<DateTimeRange @bind-Value="@DateTimeRangeValue2" />
</div>
<div class="form-group col-12 col-sm-6">
<div>
@if (DateTimeRangeValue2.Start != DateTime.MinValue)
{
<span>时间范围:</span> @DateTimeRangeValue2.Start.ToString("yyyy-MM-dd");
}
@if (DateTimeRangeValue2.End != DateTime.MinValue)
{
<span> - </span> @DateTimeRangeValue2.End.ToString("yyyy-MM-dd");
}
</div>
</div>
</div>
</div>
</Block>
<Block Title="禁用" Introduction="设置 <code>IsDisabled</code> 属性值为 <code>true</code> 时,组件禁止输入" CodeFile="datetimerange.3.html">
<div class="form-inline">
<div class="row">
<div class="col-12">
<DateTimeRange Value="@DateTimeRangeValue3" IsDisabled="true" />
</div>
</div>
</div>
</Block>
<AttributeTable Items="@GetAttributes()" />

View File

@@ -0,0 +1,90 @@
using BootstrapBlazor.Components;
using BootstrapBlazor.Shared.Common;
using BootstrapBlazor.Shared.Pages.Components;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
namespace BootstrapBlazor.Shared.Pages
{
/// <summary>
///
/// </summary>
public sealed partial class DateTimeRanges
{
[NotNull]
private Logger? DateLogger { get; set; }
private DateTimeRangeValue DateTimeRangeValue1 { get; set; } = new DateTimeRangeValue();
private DateTimeRangeValue DateTimeRangeValue2 { get; set; } = new DateTimeRangeValue();
private DateTimeRangeValue DateTimeRangeValue3 { get; set; } = new DateTimeRangeValue() { Start = DateTime.Today, End = DateTime.Today.AddDays(3) };
private Task OnConfirm(DateTimeRangeValue value)
{
DateLogger?.Log($"选择的时间范围是: {value.Start:yyyy-MM-dd} - {value.End:yyyy-MM-dd}");
return Task.CompletedTask;
}
/// <summary>
/// 获得属性方法
/// </summary>
/// <returns></returns>
private IEnumerable<AttributeItem> GetAttributes() => new AttributeItem[]
{
new AttributeItem() {
Name = "ShowLabel",
Description = "是否显示前置标签",
Type = "bool",
ValueList = "true|false",
DefaultValue = "true"
},
new AttributeItem() {
Name = "ShowSidebar",
Description = "是否显示快捷侧边栏",
Type = "bool",
ValueList = "true|false",
DefaultValue = "false"
},
new AttributeItem()
{
Name = "IsDisabled",
Description = "是否禁用 默认为 fasle",
Type = "bool",
ValueList = "true|false",
DefaultValue = "false"
},
new AttributeItem()
{
Name = "Placement",
Description = "设置弹窗出现位置",
Type = "Placement",
ValueList = "top|bottom|left|right",
DefaultValue = "auto"
},
new AttributeItem() {
Name = "DisplayText",
Description = "前置标签显示文本",
Type = "string",
ValueList = " — ",
DefaultValue = " — "
},
new AttributeItem() {
Name = "DateFormat",
Description = "日期格式字符串 默认为 yyyy-MM-dd",
Type = "string",
ValueList = " — ",
DefaultValue = "yyyy-MM-dd"
},
new AttributeItem() {
Name = "Value",
Description = "包含开始时间结束时间的自定义类",
Type = "DateTimeRangeValue",
ValueList = "",
DefaultValue = " — "
}
};
}
}

View File

@@ -1,6 +1,6 @@
@page "/install-wasm"
<InstallContent Title="客户端渲染模式">
<InstallContent Title="客户端渲染模式" HostFile="wwwroot/index.html">
<Pre>public class Program
{
public static async Task Main(string[] args)

View File

@@ -1,6 +1,6 @@
@page "/docs"
@page "/introduction"
@inject WebsiteOptions WebsiteOption
<h3>简介</h3>
<p>BootstrapBlazor 是一套 Bootstrap 风格的 Blazor UI 组件库,可以认为是 Bootstrap 项目的 Blazor 版实现。</p>
@@ -15,7 +15,7 @@
<p>国内最大代码托管协作开发平台 <b><a href="https://gitee.com/LongbowEnterprise/BootstrapBlazor" target="_blank">码云</a></b> C# 板块最高星 <a href='https://gitee.com/LongbowEnterprise/BootstrapAdmin/stargazers'><img src='https://gitee.com/LongbowEnterprise/BootstrapAdmin/badge/star.svg?theme=gvp' alt='star' style="margin-bottom: 1px;" /></a> 作品 <b><a href="https://gitee.com/LongbowEnterprise/BootstrapAdmin" target="_blank">通用后台管理系统 BootstrapAdmin</a></b> 准备使用本组件实现全部功能</p>
<p>演示网站:<a href="https://ba.sdgxgz.com/Pages" target="_blank">https://ba.sdgxgz.com</a></p>
<p>演示网站:<a href="@($"{WebsiteOption.AdminUrl}/Pages")" target="_blank">@WebsiteOption.AdminUrl</a></p>
<h4>快速上手</h4>

View File

@@ -140,6 +140,13 @@ namespace BootstrapBlazor.Shared.Pages
Type = "Func<bool, Task>",
ValueList = " — ",
DefaultValue = " — "
},
new AttributeItem() {
Name = "OnClickMenu",
Description = "点击菜单项时回调委托",
Type = "Func<bool, MenuItem>",
ValueList = " — ",
DefaultValue = " — "
}
};
}

View File

@@ -1,4 +1,5 @@
@page "/listviews"
@inject WebsiteOptions WebsiteOption
<h3>ListView 列表视图</h3>

View File

@@ -24,7 +24,7 @@ namespace BootstrapBlazor.Shared.Pages
Products = Enumerable.Range(1, 100).Select(i => new Product()
{
ImageUrl = $"https://imgs.sdgxgz.com/images/Pic{i}.jpg",
ImageUrl = $"{WebsiteOption.ImageLibUrl}/images/Pic{i}.jpg",
Description = $"Pic{i}.jpg",
Category = $"Group{(i % 4) + 1}"
});

View File

@@ -25,7 +25,7 @@
</div>
</div>
<div class="form-group col-12">
<Button @onclick="e => Modal?.Toggle()">弹窗</Button>
<Button @onclick="@(e => Modal.Toggle())">弹窗</Button>
<Modal @ref="Modal">
<ModalDialog Title="默认弹窗">
<BodyTemplate>
@@ -42,7 +42,7 @@
<div class="form-inline">
<div class="row">
<div class="form-group col-12">
<Button @onclick="e => BackdropModal?.Toggle()">弹窗</Button>
<Button @onclick="@(e => BackdropModal.Toggle())">弹窗</Button>
<Modal @ref="BackdropModal" IsBackdrop="true">
<ModalDialog Title="点击背景可关闭弹窗">
<BodyTemplate>
@@ -59,7 +59,7 @@
<div class="form-inline">
<div class="row">
<div class="form-group col-12 col-sm-4 col-lg-auto">
<Button @onclick="e => SmailModal?.Toggle()">小弹窗</Button>
<Button @onclick="@(e => SmailModal.Toggle())">小弹窗</Button>
<Modal @ref="SmailModal">
<ModalDialog Size="Size.Small" Title="小弹窗">
<BodyTemplate>
@@ -69,7 +69,7 @@
</Modal>
</div>
<div class="form-group col-12 col-sm-4 col-lg-auto">
<Button @onclick="e => LargeModal?.Toggle()">大弹窗</Button>
<Button @onclick="@(e => LargeModal.Toggle())">大弹窗</Button>
<Modal @ref="LargeModal">
<ModalDialog Size="Size.Large" Title="大弹窗">
<BodyTemplate>
@@ -79,7 +79,7 @@
</Modal>
</div>
<div class="form-group col-12 col-sm-4 col-lg-auto">
<Button @onclick="e => ExtraLargeModal?.Toggle()">超大弹窗</Button>
<Button @onclick="@(e => ExtraLargeModal.Toggle())">超大弹窗</Button>
<Modal @ref="ExtraLargeModal">
<ModalDialog Size="Size.ExtraLarge" Title="超大弹窗">
<BodyTemplate>
@@ -96,7 +96,7 @@
<div class="form-inline">
<div class="row">
<div class="form-group col-12 col-sm-4 col-lg-auto">
<Button @onclick="e => CenterModal?.Toggle()">垂直居中的弹窗</Button>
<Button @onclick="@(e => CenterModal.Toggle())">垂直居中的弹窗</Button>
<Modal @ref="CenterModal">
<ModalDialog IsCentered="true" Title="垂直居中的弹窗">
<BodyTemplate>
@@ -113,7 +113,7 @@
<div class="form-inline">
<div class="row">
<div class="form-group col-12 col-sm-4 col-lg-auto">
<Button @onclick="e => LongContentModal?.Toggle()">内容超长的弹窗</Button>
<Button @onclick="@(e => LongContentModal.Toggle())">内容超长的弹窗</Button>
<Modal @ref="LongContentModal">
<ModalDialog IsCentered="true" Title="内容超长的弹窗">
<BodyTemplate>
@@ -140,7 +140,7 @@
</Modal>
</div>
<div class="form-group col-12 col-sm-4 col-lg-auto">
<Button @onclick="e => ScrollModal?.Toggle()">内置滚动条弹窗</Button>
<Button @onclick="@(e => ScrollModal.Toggle())">内置滚动条弹窗</Button>
<Modal @ref="ScrollModal">
<ModalDialog IsCentered="true" IsScrolling="true" Title="内置滚动条弹窗">
<BodyTemplate>
@@ -174,7 +174,7 @@
<div class="form-inline">
<div class="row">
<div class="form-group col-12">
<button class="btn btn-primary" @onclick="e => CascadeModal?.Toggle()">弹窗</button>
<button class="btn btn-primary" @onclick="@(e => CascadeModal.Toggle())">弹窗</button>
<Modal @ref="CascadeModal">
<ModalDialog @ref="Dialog1" Title="内部按钮继续弹窗">
<BodyTemplate>
@@ -212,7 +212,7 @@
<div class="form-inline">
<div class="row">
<div class="form-group col-12">
<Button @onclick="e => Modal?.Toggle()">弹窗</Button>
<Button @onclick="@(e => Modal.Toggle())">弹窗</Button>
<Modal @ref="Modal">
<ModalDialog Title="默认弹窗" IsDraggable="true">
<BodyTemplate>

View File

@@ -1,6 +1,7 @@
using BootstrapBlazor.Components;
using BootstrapBlazor.Shared.Common;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
namespace BootstrapBlazor.Shared.Pages
{
@@ -12,46 +13,55 @@ namespace BootstrapBlazor.Shared.Pages
/// <summary>
///
/// </summary>
[NotNull]
private Modal? Modal { get; set; }
/// <summary>
///
/// </summary>
[NotNull]
private Modal? BackdropModal { get; set; }
/// <summary>
///
/// </summary>
[NotNull]
private Modal? SmailModal { get; set; }
/// <summary>
///
/// </summary>
[NotNull]
private Modal? LargeModal { get; set; }
/// <summary>
///
/// </summary>
[NotNull]
private Modal? ExtraLargeModal { get; set; }
/// <summary>
///
/// </summary>
[NotNull]
private Modal? CenterModal { get; set; }
/// <summary>
///
/// </summary>
[NotNull]
private Modal? LongContentModal { get; set; }
/// <summary>
///
/// </summary>
[NotNull]
private Modal? ScrollModal { get; set; }
/// <summary>
///
/// </summary>
[NotNull]
private Modal? CascadeModal { get; set; }
/// <summary>
@@ -73,7 +83,7 @@ namespace BootstrapBlazor.Shared.Pages
///
/// </summary>
/// <returns></returns>
private IEnumerable<AttributeItem> GetAttributes()
private static IEnumerable<AttributeItem> GetAttributes()
{
return new AttributeItem[]
{

View File

@@ -42,6 +42,10 @@
<div class="form-group col-12 col-sm-6">
<MultiSelect Items="@Items" @bind-Value="@SelectedItemsValue"></MultiSelect>
</div>
<div class="form-group col-12 col-sm-6">
<Button Icon="fa fa-plus" Text="添加" OnClick="@AddItems" class="mr-1"></Button>
<Button Icon="fa fa-minus" Text="减少" OnClick="@RemoveItems"></Button>
</div>
</div>
</div>
<div class="mt-3">@SelectedItemsValue</div>
@@ -54,6 +58,10 @@
<div class="form-group col-12 col-sm-6">
<MultiSelect Items="@Items" @bind-Value="@SelectedArrayValues"></MultiSelect>
</div>
<div class="form-group col-12 col-sm-6">
<Button Icon="fa fa-plus" Text="添加" OnClick="@AddListItems" class="mr-1"></Button>
<Button Icon="fa fa-minus" Text="减少" OnClick="@RemoveListItems"></Button>
</div>
</div>
</div>
<div class="mt-3">@(string.Join(",", SelectedArrayValues))</div>

View File

@@ -53,6 +53,26 @@ namespace BootstrapBlazor.Shared.Pages
private string SelectedItemsValue { get; set; } = "Beijing,Chengdu";
private void AddItems()
{
SelectedItemsValue = "Beijing,Chengdu,Hangzhou,Lianyungang";
}
private void RemoveItems()
{
SelectedItemsValue = "Beijing,Chengdu";
}
private void AddListItems()
{
SelectedArrayValues = "Beijing,Chengdu,Hangzhou,Lianyungang".Split(',');
}
private void RemoveListItems()
{
SelectedArrayValues = "Beijing,Chengdu".Split(',');
}
private IEnumerable<string> SelectedArrayValues { get; set; } = Enumerable.Empty<string>();
private IEnumerable<SelectedItem> OnSearch(string searchText)

View File

@@ -1,4 +1,5 @@
@page "/navs"
@inject WebsiteOptions WebsiteOption
<h3>Nav 导航组件</h3>

View File

@@ -18,7 +18,7 @@ namespace BootstrapBlazor.Shared.Pages
var link = new NavLink();
link.SetParametersAsync(ParameterView.FromDictionary(new Dictionary<string, object>()
{
["href"] = "http://ba.sdgxgz.com",
["href"] = WebsiteOption.AdminUrl,
["class"] = "nav-link nav-item",
["target"] = "_blank",
["ChildContent"] = new RenderFragment(builder =>

View File

@@ -1,4 +1,4 @@
@page "/rates"
@page "/rates"
<h3>Rate 评分</h3>
@@ -7,7 +7,7 @@
<Block Title="基本用法" Introduction="<code>Rate</code> 组件通过 1 - 5 颗星表示数值等级,后台可以通过 <code>bind-Value</code> 对数值进行双向绑定通过 <code>Rate</code> 组件更改其值,鼠标滑动更改值,点击星星时确认其值" CodeFile="rate.1.html">
<div class="form-inline">
<div class="row">
<div class="form-group col-12">
<div class="col-12">
<Rate Value="@BindValue" ValueChanged="@OnValueChanged" />
</div>
</div>
@@ -15,6 +15,19 @@
<Logger @ref="Trace" class="mt-3" />
</Block>
<Block Title="禁用" Introduction="通过设置 <code>IsDisable</code> 属性值禁用组件" CodeFile="rate.2.html">
<div class="form-inline">
<div class="row">
<div class="form-group col-6">
<Rate Value="@BindValue1" IsDisable="IsDisable" />
</div>
<div class="form-group col-6">
<Switch @bind-Value="IsDisable" OnText="禁用" OnColor="Color.Danger" OffText="启用" OffColor="@Color.Success" />
</div>
</div>
</div>
</Block>
<AttributeTable Items="@GetAttributes()" />
<EventTable Items="@GetEvents()" />

View File

@@ -9,7 +9,11 @@ namespace BootstrapBlazor.Shared.Pages
/// </summary>
public sealed partial class Rates
{
private int BindValue { get; set; } = 0;
private int BindValue { get; set; } = 3;
private int BindValue1 { get; set; } = 2;
private bool IsDisable { get; set; }
/// <summary>
///
@@ -26,7 +30,7 @@ namespace BootstrapBlazor.Shared.Pages
/// 获得事件方法
/// </summary>
/// <returns></returns>
private IEnumerable<EventItem> GetEvents() => new EventItem[]
private static IEnumerable<EventItem> GetEvents() => new EventItem[]
{
new EventItem()
{
@@ -40,7 +44,7 @@ namespace BootstrapBlazor.Shared.Pages
/// 获得属性方法
/// </summary>
/// <returns></returns>
private IEnumerable<AttributeItem> GetAttributes() => new AttributeItem[]
private static IEnumerable<AttributeItem> GetAttributes() => new AttributeItem[]
{
// TODO: 移动到数据库中
new AttributeItem() {
@@ -50,6 +54,14 @@ namespace BootstrapBlazor.Shared.Pages
ValueList = " — ",
DefaultValue = " — "
},
new AttributeItem()
{
Name = "IsDisabled",
Description = "是否禁用 默认为 fasle",
Type = "bool",
ValueList = "true|false",
DefaultValue = "false"
}
};
}
}

View File

@@ -6,17 +6,24 @@
<p>由于滚动条组件内部屏蔽了系统的滚动条,设置了 <code>overflow: hidden</code> 所以自身或者其父元素必须拥有固定高度时才可呈现滚动条,可以通过外套元素设置其 <code>height</code> 或者直接设置 <code>Scroll</code> 组件的高度 <code>Height</code> 属性</p>
<p>特别注意:</p>
<p>本组件是使用 <code>slimscroll</code> 脚本来实现滚动条美化的,由于移动端与苹果系统无需滚动条美化,所以增加了 <code>IsForce</code> 属性,</p>
<ul class="ul-demo">
<li><b>True</b>: 默认值;为真时不判断是否为移动端或者苹果系统一律利用 <code>slimscroll</code> 进行美化</li>
<li><b>False</b>: 为假时脚本内部自行判断为移动端或者苹果系统时不进行美化使用原生样式</li>
</ul>
<Block Title="普通用法" Introduction="给组件增加滚动条,通过设置 <code>Height</code> 高度值为 200px 使内部子元素高度为 400px 时出现滚动条" CodeFile="scroll.1.html">
<Scroll class="scroll-demo" IsAutoHide="false" Height="200px">
<div style="height: 400px;">Top</div>
<div>Bottom</div>
<div style="height: 400px;">请滚动右侧滚动条</div>
<div>我是最底端</div>
</Scroll>
</Block>
<Block Title="自动隐藏" Introduction="鼠标 <code>hover</code> 状态下自动显示滚动条,移开鼠标后滚动条自动隐藏" CodeFile="scroll.2.html">
<Scroll class="scroll-demo" Height="200px">
<div style="height: 400px;">Top</div>
<div>Bottom</div>
<div style="height: 400px;">鼠标悬停右侧出现滚动条</div>
<div>我是最底端</div>
</Scroll>
</Block>

View File

@@ -42,6 +42,13 @@ namespace BootstrapBlazor.Shared.Pages
Type = "true",
ValueList = "true|false",
DefaultValue = "true"
},
new AttributeItem() {
Name = "IsForce",
Description = "是否强制使用滚动条",
Type = "true",
ValueList = "true|false",
DefaultValue = "true"
}
};
}

View File

@@ -501,6 +501,13 @@ namespace BootstrapBlazor.Shared.Pages
ValueList = " — ",
DefaultValue = "fa fa-sort-desc"
},
new AttributeItem() {
Name = "EditDialogSaveButtonText",
Description = "编辑弹窗中保存按钮文字",
Type = "string",
ValueList = " — ",
DefaultValue = " — "
},
new AttributeItem() {
Name = "RenderModel",
Description = "Table 组件布局模式设置",

View File

@@ -44,7 +44,7 @@ namespace BootstrapBlazor.Shared.Pages
///
/// </summary>
/// <returns></returns>
protected Task<BindItem> OnAddAsync()
protected static Task<BindItem> OnAddAsync()
{
return Task.FromResult(new BindItem() { DateTime = DateTime.Now });
}
@@ -68,12 +68,15 @@ namespace BootstrapBlazor.Shared.Pages
else
{
var oldItem = EditItems.FirstOrDefault(i => i.Id == item.Id);
oldItem.Name = item.Name;
oldItem.Address = item.Address;
oldItem.DateTime = item.DateTime;
oldItem.Count = item.Count;
oldItem.Complete = item.Complete;
oldItem.Education = item.Education;
if (oldItem != null)
{
oldItem.Name = item.Name;
oldItem.Address = item.Address;
oldItem.DateTime = item.DateTime;
oldItem.Count = item.Count;
oldItem.Complete = item.Complete;
oldItem.Education = item.Education;
}
}
return Task.FromResult(true);
}

View File

@@ -25,7 +25,7 @@
</Block>
<Block Title="嵌套 Table 组件应用" Introduction="通过设置 <code>DetailRowTemplate</code> 模板设置明细行为子表数据" CodeFile="table.48.html">
<p>明细行内嵌套另外一个 <code>Table</code> 组件,由于每行都要关联子表数据,出于性能的考虑,此功能采用<code>懒加载</code>模式,即点击展开按钮后,再对嵌套 <code>Table</code> 进行数据填充</p>
<p>明细行内嵌套另外一个 <code>Table</code> 组件,由于每行都要关联子表数据,出于性能的考虑,此功能采用 <code>懒加载</code> 模式,即点击展开按钮后,再对嵌套 <code>Table</code> 进行数据填充,通过 <code>ShowDetailRow</code> 回调委托可以控制每一行是否显示明细行,本例中通过 <code>Complete</code> 属性来控制是否显示明细行,可通过翻页来测试本功能</p>
<Table TItem="BindItem"
IsPagination="true" PageItemsSource="@PageItemsSource"
IsStriped="true" IsBordered="true"

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace BootstrapBlazor.Shared.Pages.Table
{

View File

@@ -59,7 +59,10 @@ namespace BootstrapBlazor.Shared.Pages.Table
private Task<bool> OnSaveAsync(Product item)
{
var oldItem = Products.FirstOrDefault(i => i.Id == item.Id);
oldItem.Sum = item.Sum;
if (oldItem != null)
{
oldItem.Sum = item.Sum;
}
return Task.FromResult(true);
}
@@ -79,7 +82,7 @@ namespace BootstrapBlazor.Shared.Pages.Table
}
_confirm = false;
var total = items.Count();
var total = items.Count;
// 内存分页
items = items.Skip((options.PageIndex - 1) * options.PageItems).Take(options.PageItems).ToList();
return Task.FromResult(new QueryData<Product>()
@@ -93,7 +96,7 @@ namespace BootstrapBlazor.Shared.Pages.Table
{
var items = ProductSelectItems;
var total = items.Count();
var total = items.Count;
// 内存分页
items = items.Skip((options.PageIndex - 1) * options.PageItems).Take(options.PageItems).ToList();

View File

@@ -34,7 +34,7 @@
<Block Title="Toast 手动关闭" Introduction="不会自动关闭,需要人工点击关闭按钮" CodeFile="toast.2.html">
<div class="form-inline">
<div class="row">
<div class="form-group col-12">
<div class="col-12">
<Button OnClick="@OnNotAutoHideClick">成功通知</Button>
</div>
</div>
@@ -99,6 +99,29 @@
<Pre>&lt;Toast /&gt;</Pre>
<Alert ShowBar="true" Color="@Color.Info">特别说明: 可以通过 <code>BootstrapBlazorOptions</code> 全局统一配置参数可以设置整个系统内的 <code>Toast</code> 组件 <code>Delay</code> 参数值</Alert>
<p>通过配置文件 <code>appsetting.json</code> 文件配置,适用于 <code>Server-Side App</code></p>
<Pre>"BootstrapBlazorOptions": {
"ToastDelay": 4000,
"MessageDelay": 4000,
"SwalDelay": 4000
}
</Pre>
<p>通过 <code>Startup</code> 文件中的 <code>ConfigureServices</code> 方法配置,适用于 <code>Server-Side App</code> 和 <code>WebAssembly App</code></p>
<Pre>public void ConfigureServices(IServiceCollection services)
{
// 统一设置 Toast 组件自动消失时间
services.Configure&lt;BootstrapBlazorOptions&gt;(options =>
{
options.ToastDelay = 4000;
});
}
</Pre>
<Toast @ref="Toast"></Toast>
<AttributeTable Items="@GetAttributes()" />

View File

@@ -1,6 +1,7 @@
@using System.Diagnostics.CodeAnalysis
@inherits LayoutComponentBase
@inject IJSRuntime JSRuntime
@inject WebsiteOptions WebsiteOption
<header class="navbar navbar-expand navbar-dark flex-column flex-md-row">
<div class="header-img navbar-brand">
@@ -19,10 +20,10 @@
<a class="nav-link" href="components">组件</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://blazor.sdgxgz.com/" title="WebAssembly Server">server</a>
<a class="nav-link" href="@WebsiteOption.ServerUrl" title="Server">server</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://wasm.sdgxgz.com/" title="WebAssembly Client">wasm</a>
<a class="nav-link" href="@WebsiteOption.WasmUrl" title="WebAssembly Client">wasm</a>
</li>
</ul>
</div>

View File

@@ -1,63 +1,126 @@
@inherits LayoutComponentBase
@using Microsoft.Extensions.DependencyInjection
@using Microsoft.Extensions.Configuration
@using System.Globalization
@inherits LayoutComponentBase
@layout BaseLayout
@inject ICultureStorage CultureStorage
@inject NavigationManager NavigationManager
@inject IJSRuntime JSRuntime
@Body
<footer class="home-footer">
<div>
<h4>相关作品</h4>
<ul>
<li>
<a class="footer-link" href="https://gitee.com/LongbowEnterprise/BootstrapAdmin" target="_blank">Bootstrap Admin</a>
</li>
<li>
<a class="footer-link" href="https://gitee.com/LongbowEnterprise/SliderCaptcha" target="_blank">滑块验证码</a>
</li>
<li>
<a class="footer-link" href="https://gitee.com/LongbowEnterprise/longbow-select" target="_blank">Longbow-select</a>
</li>
<li>
<a class="footer-link" href="https://gitee.com/LongbowEnterprise/longbow-validate" target="_blank">Longbow-validate</a>
</li>
</ul>
<footer>
<div class="footer-body">
<div>
<h4>相关作品</h4>
<ul>
<li>
<a class="footer-link" href="https://gitee.com/LongbowEnterprise/BootstrapAdmin" target="_blank">Bootstrap Admin</a>
</li>
<li>
<a class="footer-link" href="https://gitee.com/LongbowEnterprise/SliderCaptcha" target="_blank">滑块验证码</a>
</li>
<li>
<a class="footer-link" href="https://gitee.com/LongbowEnterprise/longbow-select" target="_blank">Longbow-select</a>
</li>
<li>
<a class="footer-link" href="https://gitee.com/LongbowEnterprise/longbow-validate" target="_blank">Longbow-validate</a>
</li>
</ul>
</div>
<div>
<h4>友情链接</h4>
<ul>
<li>
<a class="footer-link" href="https://gitee.com/monksoul/Fur" target="_blank">Fur</a>
</li>
<li>
<a class="footer-link" href="https://ant-design-blazor.github.io/" target="_blank">Ant design of blazor</a>
</li>
<li>
<a class="footer-link" href="https://dotnet9.com/" target="_blank">Dotnet9</a>
</li>
<li>
<a class="footer-link" href="http://www.mrhuo.com/" target="_blank">M&J</a>
</li>
</ul>
</div>
<div>
<h4>社区</h4>
<ul>
<li>
<div class="footer-link">贡献指南</div>
</li>
<li>
<div class="footer-link">加入我们</div>
</li>
<li>
<div class="footer-link">联系方式</div>
</li>
</ul>
</div>
<div>
<h4>特别鸣谢</h4>
<ul>
<li>
<div class="footer-link">上海智通建设发展股份有限公司</div>
</li>
</ul>
</div>
</div>
<div>
<h4>友情链接</h4>
<ul>
<li>
<a class="footer-link" href="https://gitee.com/monksoul/Fur" target="_blank">Fur</a>
</li>
<li>
<a class="footer-link" href="https://ant-design-blazor.github.io/" target="_blank">Ant design of blazor</a>
</li>
<li>
<a class="footer-link" href="https://dotnet9.com/" target="_blank">Dotnet9</a>
</li>
<li>
<a class="footer-link" href="http://www.mrhuo.com/" target="_blank">M&J</a>
</li>
</ul>
</div>
<div>
<h4>社区</h4>
<ul>
<li>
<div class="footer-link">贡献指南</div>
</li>
<li>
<div class="footer-link">加入我们</div>
</li>
<li>
<div class="footer-link">联系方式</div>
</li>
</ul>
</div>
<div>
<h4>特别鸣谢</h4>
<ul>
<li>
<div class="footer-link">上海智通建设发展股份有限公司</div>
</li>
</ul>
<div class="footer-info d-none d-sm-flex">
<div>Powered by .NET @Version on Linux</div>
<div class="d-flex flex-fill align-items-center justify-content-center">
<a class="ml-3" href="https://gitee.com/LongbowEnterprise/BootstrapBlazor" target="_blank">码云代码托管平台</a>
<div class="mx-3">
<img alt="12377@2x" class="footer-logo mr-1" src="_content/BootstrapBlazor.Shared/images/12377@2x.png">
<a href="https://12377.cn" target="_blank">违法和不良信息举报中心</a>
</div>
<div class="mr-3">
<a href="http://www.beian.miit.gov.cn/" target="_blank">鲁ICP备19015061号</a>
</div>
</div>
<div>
<img alt="global" class="footer-lang" src="_content/BootstrapBlazor.Shared/images/global.svg" />
<a @onclick:preventDefault @onclick="@(e => SetLang("zh-CN"))">简 体</a>
/
<a @onclick:preventDefault @onclick="@(e => SetLang("zh-TW"))">繁 體</a>
/
<a @onclick:preventDefault @onclick="@(e => SetLang("en-US"))">English</a>
</div>
</div>
</footer>
@code {
private string Version => Environment.Version.ToString();
private string SelectedCulture { get; set; } = CultureInfo.CurrentUICulture.Name;
private async Task SetLang(string cultureName)
{
if (CultureStorage.Mode == CultureStorageMode.Webapi)
{
// 使用 api 方式 适用于 Server-Side 模式
if (SelectedCulture != cultureName)
{
var culture = cultureName;
var uri = new Uri(NavigationManager.Uri).GetComponents(UriComponents.PathAndQuery, UriFormat.Unescaped);
var query = $"?culture={Uri.EscapeDataString(culture)}&redirectUri={Uri.EscapeDataString(uri)}";
// use a path that matches your culture redirect controller from the previous steps
NavigationManager.NavigateTo("/Culture/SetCulture" + query, forceLoad: true);
}
}
else
{
if (cultureName != CultureInfo.CurrentCulture.Name)
{
await JSRuntime.InvokeVoidAsync(identifier: "$.blazorCulture.set", cultureName);
var culture = new CultureInfo(cultureName);
CultureInfo.CurrentCulture = culture;
CultureInfo.CurrentUICulture = culture;
NavigationManager.NavigateTo(NavigationManager.Uri, forceLoad: true);
}
}
}
}

View File

@@ -3,7 +3,7 @@
<section class="section">
<div class="sidebar">
<Scroll>
<Scroll IsForce="false">
<NavMenu />
</Scroll>
</div>

View File

@@ -1,5 +1,5 @@
using BootstrapBlazor.Components;
using Microsoft.AspNetCore.Components;
using BootstrapBlazor.Shared.Pages.Components;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@@ -47,49 +47,49 @@ namespace BootstrapBlazor.Shared.Shared
private void InitMenus()
{
// 快速入门
var item = new MenuItem()
var item = new DemoMenuItem()
{
Text = "快速上手",
Icon = "fa fa-fw fa-fa"
};
AddQuickStar(item);
item = new MenuItem()
item = new DemoMenuItem()
{
Text = "布局组件",
Icon = "fa fa-fw fa-desktop"
};
AddLayout(item);
item = new MenuItem()
item = new DemoMenuItem()
{
Text = "导航组件",
Icon = "fa fa-fw fa-bars"
};
AddNavigation(item);
item = new MenuItem()
item = new DemoMenuItem()
{
Text = "表单组件",
Icon = "fa fa-fw fa-cubes"
};
AddForm(item);
item = new MenuItem()
item = new DemoMenuItem()
{
Text = "数据组件",
Icon = "fa fa-fw fa-database"
};
AddData(item);
item = new MenuItem()
item = new DemoMenuItem()
{
Text = "消息组件",
Icon = "fa fa-fw fa-comments"
};
AddNotice(item);
item = new MenuItem()
item = new DemoMenuItem()
{
Text = "组件总览",
Icon = "fa fa-fw fa-fa",
@@ -98,39 +98,39 @@ namespace BootstrapBlazor.Shared.Shared
AddSummary(item);
}
private void AddQuickStar(MenuItem item)
private void AddQuickStar(DemoMenuItem item)
{
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "简介",
Url = "introduction"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "类库安装",
Url = "install"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "项目模板",
Url = "template"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "全球化",
Url = "globalization"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "本地化",
Url = "localization"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "服务器端模式 Server",
Url = "install-server"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "客户端模式 wasm",
Url = "install-wasm"
@@ -140,114 +140,121 @@ namespace BootstrapBlazor.Shared.Shared
Menus.Add(item);
}
private void AddForm(MenuItem item)
private void AddForm(DemoMenuItem item)
{
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "表单组件 EditorForm",
Url = "editorforms"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "表单组件 ValidateForm",
Url = "forms"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "自动完成 AutoComplete",
Url = "autocompletes"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "按钮 Button",
Url = "buttons"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "多选框 Checkbox",
Url = "checkboxs"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "多选框组 CheckboxList",
Url = "checkboxlists"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "时间框 DateTimePicker",
Url = "datetimepickers"
Url = "datetimepickers",
IsUpdate = true
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "时间范围框 DateTimeRange",
Url = "datetimeranges",
IsNew = true
});
item.AddItem(new DemoMenuItem()
{
Text = "下拉框 DropdownList",
Url = "dropdownlists"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "富文本框 Editor",
Url = "editors"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "输入框 Input",
Url = "inputs"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "数值框 InputNumber",
Url = "inputnumbers"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "富文本框 Markdown",
Url = "markdowns"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "单选框 Radio",
Url = "radios"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "评分 Rate",
Url = "rates"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "选择器 Select",
Url = "selects"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "多项选择器 MultiSelect",
Url = "multi-selects"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "滑块 Slider",
Url = "sliders"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "开关 Switch",
Url = "switchs"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "多行文本框 Textarea",
Url = "textareas"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "开关 Toggle",
Url = "toggles"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "穿梭框 Transfer",
Url = "transfers"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "上传组件 Upload",
Url = "uploads"
@@ -256,105 +263,105 @@ namespace BootstrapBlazor.Shared.Shared
AddBadge(item);
}
private void AddData(MenuItem item)
private void AddData(DemoMenuItem item)
{
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "头像框 Avatar",
Url = "avatars"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "徽章 Badge",
Url = "badges"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "卡片 Card",
Url = "cards"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "日历框 Calendar",
Url = "calendars"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "验证码 Captcha",
Url = "captchas"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "走马灯 Carousel",
Url = "carousels"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "图表 Chart",
Url = "charts"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "进度环 Circle",
Url = "circles"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "折叠 Collapse",
Url = "collapses"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "列表组件 ListView",
Url = "listviews"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "弹出框 Popover",
Url = "popovers"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "二维码 QRCode",
Url = "qrcodes"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "搜索框 Search",
Url = "searchs"
});
AddTableItem(item);
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "标签 Tag",
Url = "tags"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "时间线 Timeline",
Url = "timelines"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "工具条 Tooltip",
Url = "tooltips"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "树形控件 Tree",
Url = "trees"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "条码扫描 BarcodeReader",
Url = "barcodereaders"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "摄像头组件 Camera",
Url = "Cameras"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "手写签名 HandwrittenPage",
Url = "handwrittenPage"
@@ -363,116 +370,116 @@ namespace BootstrapBlazor.Shared.Shared
AddBadge(item);
}
private void AddTableItem(MenuItem item)
private void AddTableItem(DemoMenuItem item)
{
var it = new MenuItem()
var it = new DemoMenuItem()
{
Text = "表格 Table"
};
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "基本功能",
Url = "tables"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "列设置",
Url = "tables/column"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "行设置",
Url = "tables/row"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "明细行",
Url = "tables/detail"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "搜索功能",
Url = "tables/search"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "筛选和排序",
Url = "tables/filter"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "固定表头",
Url = "tables/header"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "表头分组",
Url = "tables/multi-header"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "固定列",
Url = "tables/fix-column"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "分页功能",
Url = "tables/pages"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "工具栏",
Url = "tables/toolbar"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "表单维护",
Url = "tables/edit"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "导出功能",
Url = "tables/export"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "行选中",
Url = "tables/selection"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "自动刷新",
Url = "tables/autorefresh"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "统计合并",
Url = "tables/footer"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "弹窗联动",
Url = "tables/dialog"
});
it.AddItem(new MenuItem()
it.AddItem(new DemoMenuItem()
{
Text = "折行演示",
Url = "tables/wrap"
@@ -483,69 +490,69 @@ namespace BootstrapBlazor.Shared.Shared
AddBadge(it, false);
}
private void AddNotice(MenuItem item)
private void AddNotice(DemoMenuItem item)
{
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "警告框 Alert",
Url = "alerts"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "控制台 Console",
Url = "consoles"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "对话框 Dialog",
Url = "dialogs"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "抽屉 Drawer",
Url = "drawers"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "消息框 Message",
Url = "messages"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "模态框 Modal",
Url = "modals"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "指示灯 Light",
Url = "lights"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "确认框 Popconfirm",
Url = "popconfirms"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "进度条 Progress",
Url = "progresss"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "旋转图标 Spinner",
Url = "spinners"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "模态弹窗 SweetAlert",
Url = "swals"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "轻量弹窗 Toast",
Url = "toasts"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "计时器 Timer",
Url = "timers"
@@ -553,44 +560,44 @@ namespace BootstrapBlazor.Shared.Shared
AddBadge(item);
}
private void AddNavigation(MenuItem item)
private void AddNavigation(DemoMenuItem item)
{
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "面包屑 Breadcrumb",
Url = "breadcrumbs"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "菜单 Menu",
Url = "menus"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "导航栏 Nav",
Url = "navs"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "下拉菜单 Dropdown",
Url = "dropdowns"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "跳转组件 GoTop",
Url = "gotops"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "分页 Pagination",
Url = "paginations"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "步骤条 Steps",
Url = "stepss"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "标签页 Tab",
Url = "tabs"
@@ -599,34 +606,34 @@ namespace BootstrapBlazor.Shared.Shared
AddBadge(item);
}
private void AddLayout(MenuItem item)
private void AddLayout(DemoMenuItem item)
{
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "分隔线 Divider",
Url = "dividers"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "布局组件 Layout",
Url = "layouts"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "页脚组件 Footer",
Url = "footers"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "滚动条 Scroll",
Url = "scrolls"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "骨架屏 Skeleton",
Url = "skeletons"
});
item.AddItem(new MenuItem()
item.AddItem(new DemoMenuItem()
{
Text = "分割面板 Split",
Url = "splits"
@@ -635,7 +642,7 @@ namespace BootstrapBlazor.Shared.Shared
AddBadge(item);
}
private void AddSummary(MenuItem item)
private void AddSummary(DemoMenuItem item)
{
// 计算组件总数
var count = 0;
@@ -644,19 +651,43 @@ namespace BootstrapBlazor.Shared.Shared
Menus.Insert(1, item);
}
private void AddBadge(MenuItem item, bool append = true, int? count = null)
private void AddBadge(DemoMenuItem item, bool append = true, int? count = null)
{
item.Component = CreateBadge(count ?? item.Items.Count());
item.Component = CreateBadge(count ?? item.Items.Count(), item.IsNew);
if (append) Menus.Add(item);
}
private DynamicComponent CreateBadge(int count) => DynamicComponent.CreateComponent<Badge>(new KeyValuePair<string, object>[]
private static DynamicComponent CreateBadge(int count, bool isNew = false, bool isUpdate = false) => DynamicComponent.CreateComponent<State>(new KeyValuePair<string, object>[]
{
new KeyValuePair<string, object>(nameof(Badge.Color), Color.Info),
new KeyValuePair<string, object>(nameof(Badge.IsPill), true),
new KeyValuePair<string, object>(nameof(Badge.ChildContent), new RenderFragment(builder => {
builder.AddContent(0, count);
}))
new KeyValuePair<string, object>(nameof(State.Count), count),
new KeyValuePair<string, object>(nameof(State.IsNew), isNew),
new KeyValuePair<string, object>(nameof(State.IsUpdate), isUpdate)
});
private class DemoMenuItem : MenuItem
{
public bool IsNew { get; set; }
public bool IsUpdate { get; set; }
/// <summary>
///
/// </summary>
/// <param name="item"></param>
public override void AddItem(MenuItem item)
{
base.AddItem(item);
var menu = (DemoMenuItem)item;
if (menu.Parent != null)
{
var pMenu = ((DemoMenuItem)menu.Parent);
if (menu.IsNew) pMenu.IsNew = true;
if (menu.IsUpdate) pMenu.IsUpdate = true;
}
item.Component = CreateBadge(0, menu.IsNew, menu.IsUpdate);
}
}
}
}

View File

@@ -63,14 +63,6 @@ section {
font-weight: 400;
}
.sidebar .nav-link.active {
color: #007bff;
}
.sidebar .nav-link span:first-child {
width: 70px;
}
.sidebar-content {
padding: 1rem 0;
}
@@ -702,7 +694,7 @@ section {
width: 280px;
}
.home-footer {
.footer-body {
padding: 1rem;
color: #fff;
background-color: #5b6e84;
@@ -712,18 +704,18 @@ section {
justify-content: space-around;
}
.home-footer h4 {
.footer-body h4 {
margin: 1rem 0;
}
.home-footer ul {
.footer-body ul {
list-style: none;
padding: 0;
margin: 0;
padding-left: 1rem;
}
.home-footer .footer-link {
.footer-body .footer-link {
transition: all .3s linear;
color: rgba(255,255,255,.9);
text-decoration: none;
@@ -733,14 +725,35 @@ section {
cursor: pointer;
}
.home-footer .footer-link:hover {
.footer-body .footer-link:hover {
color: #40a9ff;
}
.home-footer .footer-link:not(:last-child) {
.footer-body .footer-link:not(:last-child) {
margin-top: 1rem;
}
.footer-info {
background-color: #222;
padding: 0 20px;
line-height: 42px;
color: #9d9d9d;
}
.footer-info a {
color: #9d9d9d;
}
.footer-info .footer-logo {
width: 21px;
height: 18px;
}
.footer-info .footer-lang {
width: 15px;
margin-right: 3px;
}
@media (min-width: 576px) {
.intro .card {
border-color: #dce3e8;
@@ -789,7 +802,7 @@ section {
width: 480px;
}
.home-footer {
.footer-body {
padding: 3rem;
flex-direction: row;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1605762355065" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="670" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M848.805886 805.572222c70.998007-81.260745 109.779266-184.217628 109.779266-293.14448 0-119.204939-46.421262-231.277434-130.713041-315.569212C744.876861 113.862257 634.94103 67.61598 517.788843 66.213028c-1.924839-0.599657-10.290367-0.592494-12.227486 0.01535C388.878868 67.945485 279.434224 114.159016 196.73471 196.85853 113.863281 279.730982 67.630307 389.460106 66.095347 506.415818c-0.428765 1.64957-0.436952 8.601912-0.021489 10.226922 1.082658 117.628024 47.364751 228.058113 130.660852 311.354214 84.291778 84.291778 196.36325 130.713041 315.569212 130.713041 119.204939 0 231.277434-46.421262 315.569212-130.713041 6.139837-6.139837 12.054547-12.444427 17.789155-18.871813 0.50756-0.453325 1.001817-0.928139 1.471514-1.440815C847.750857 807.012014 848.295256 806.299793 848.805886 805.572222zM107.447151 532.043499l187.501418 0c1.322112 65.678862 9.253758 127.264499 22.505573 182.112688-61.690014 16.687054-100.819197 38.371936-121.076566 51.906184C144.30971 701.336206 111.676475 620.35687 107.447151 532.043499zM195.881272 259.408121c20.090571 13.556761 59.242266 35.461653 121.340579 52.260248-12.998035 54.127781-20.827351 114.778116-22.243607 179.432649L107.525945 491.101018C112.076588 403.731134 144.437623 323.612399 195.881272 259.408121zM917.081898 491.099994 729.628576 491.099994c-1.415232-64.630996-9.240455-125.260865-22.229281-179.37432 61.95505-16.693194 101.235682-38.444591 121.56673-52.020794C880.270505 323.860039 912.537396 403.866211 917.081898 491.099994zM688.677908 491.099994 532.167319 491.099994 532.167319 335.061149c52.209082-1.094938 97.103572-6.453992 135.272893-14.033621C680.000272 373.163955 687.286212 430.896844 688.677908 491.099994zM532.167319 294.115598 532.167319 109.918435c36.84107 10.398838 72.779583 49.205679 100.926644 110.015649 8.810666 19.035542 16.645099 39.641859 23.464411 61.521169C621.531626 288.227494 580.261687 293.062616 532.167319 294.115598zM491.223814 110.273523l0 183.805236c-47.504944-1.12666-88.378863-6.001691-123.120109-12.802584 6.807033-21.812795 14.623046-42.35976 23.409153-61.344137C419.351903 159.792333 454.809463 121.175827 491.223814 110.273523zM491.223814 335.040682l0 156.059312L335.928912 491.099994c1.391696-60.213383 8.679683-117.955482 21.243837-170.099073C395.008472 328.536548 439.487499 333.887416 491.223814 335.040682zM335.893096 532.043499l155.330718 0 0 158.667719c-51.609425 1.194198-96.019891 6.563486-133.821845 14.103206C344.576873 651.927913 337.193719 593.243349 335.893096 532.043499zM491.223814 731.672118l0 182.909843c-36.415374-10.902304-71.871911-49.51881-99.709933-109.659539-8.679683-18.752086-16.409738-39.034015-23.157419-60.551074C402.9964 737.645157 443.773106 732.820268 491.223814 731.672118zM532.167319 914.937049 532.167319 731.608673c47.904033 1.025353 89.103364 5.862521 124.116809 12.656251-6.755868 21.555945-14.497179 41.87369-23.190165 60.656475C604.946902 865.73137 569.008388 904.538211 532.167319 914.937049zM532.167319 690.660052 532.167319 532.043499l156.546406 0c-1.298576 61.096497-8.66024 119.68487-21.445428 172.502819C629.154233 697.013761 584.319096 691.710988 532.167319 690.660052zM729.659275 532.043499l187.501418 0c-4.221138 88.138386-36.732599 168.973436-88.620363 233.635131-20.469194-13.668301-59.635215-35.298947-121.30374-51.868321C720.43724 659.049101 728.33921 597.585237 729.659275 532.043499zM801.518906 228.742704c-18.329461 11.570523-52.309366 29.355585-104.858186 43.493583-19.295462-63.056128-46.110177-115.004267-78.06189-150.97655C689.00025 140.410913 751.833297 178.097234 801.518906 228.742704zM406.007991 121.259738c-31.905664 35.920094-58.690704 87.768973-77.979002 150.702304-52.40351-14.241352-86.370113-32.099069-104.581893-43.587728C273.076422 177.914062 335.777463 140.364865 406.007991 121.259738zM223.917816 796.963147c18.284435-11.535731 52.098565-29.230742 104.332207-43.335994 19.271926 62.60485 45.976124 114.186645 77.757968 149.968593C335.99952 884.550994 273.472442 847.181899 223.917816 796.963147zM618.59883 903.595746c31.801287-35.803437 58.517765-87.426165 77.792761-150.08218 51.984978 14.023388 85.972047 31.631418 104.533798 43.208081C751.3329 847.061149 688.718841 884.521319 618.59883 903.595746z" p-id="671" fill="#9d9d9d"></path></svg>

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -1,18 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<OutputType>Library</OutputType>
<RazorLangVersion>3.0</RazorLangVersion>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>true</IsPackable>
<PackageIcon>logo.png</PackageIcon>
<Version>3.1.1</Version>
<Version>5.0.0</Version>
<PackageReleaseNotes>更新日志https://gitee.com/LongbowEnterprise/BootstrapBlazor/wikis</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="5.0.0" />
<PackageReference Include="EPPlus" Version="4.5.3.3" />
<PackageReference Include="BootstrapBlazor" Version="3.1.28" />
</ItemGroup>
<ItemGroup>

View File

@@ -41,7 +41,7 @@ namespace BootstrapBlazor.Components
worksheet.Column(x).Style.Numberformat.Format = "yyyy/m/d h:mm:ss";
}
var th_value = items.FirstOrDefault().GetDisplayName(pi.Name);
var th_value = items.FirstOrDefault()?.GetDisplayName(pi.Name);
worksheet.SetValue(1, x, th_value);
}

View File

@@ -1,16 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
<TargetFramework>net5.0</TargetFramework>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.1" PrivateAssets="all" />
<PackageReference Include="System.Net.Http.Json" Version="3.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.0" PrivateAssets="all" />
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
@@ -18,8 +17,8 @@
</ItemGroup>
<ItemGroup>
<Content Include="..\BootstrapBlazor.Server\wwwroot\favicon.ico" Link="wwwroot\favicon.ico" />
<Content Include="..\BootstrapBlazor.Server\wwwroot\favicon.png" Link="wwwroot\favicon.png" />
<Content Include="..\BootstrapBlazor.Server\wwwroot\favicon.ico" Link="wwwroot\favicon.ico" />
<Content Include="..\BootstrapBlazor.Server\wwwroot\favicon.png" Link="wwwroot\favicon.png" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,4 +1,5 @@
using BootstrapBlazor.Shared;
using BootstrapBlazor.Components;
using BootstrapBlazor.Shared;
using BootstrapBlazor.Shared.Data;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.DependencyInjection;
@@ -42,8 +43,12 @@ namespace BootstrapBlazor.WebAssembly.ClientHost
builder.Services.AddSingleton<WeatherForecastService>();
builder.Services.AddSingleton<WebsiteOptions>();
builder.Services.AddSingleton<ICultureStorage, DefaultCultureStorage>();
builder.Services.Configure<BootstrapBlazorOptions>(op => op.ToastDelay = 4000);
var host = builder.Build();
await GetCultureAsync(host);
@@ -55,7 +60,7 @@ namespace BootstrapBlazor.WebAssembly.ClientHost
private static async Task GetCultureAsync(WebAssemblyHost host)
{
var jsRuntime = host.Services.GetRequiredService<IJSRuntime>();
var cultureName = await jsRuntime.InvokeAsync<string>("$.blazorCulture.get") ?? "zh-CN";
var cultureName = await jsRuntime.InvokeAsync<string>("$.blazorCulture.get") ?? CultureInfo.CurrentCulture.Name;
var culture = new CultureInfo(cultureName);
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;

View File

@@ -15,7 +15,7 @@
<link rel="stylesheet" href="style/loading.css">
<link rel="stylesheet" href="_content/BootstrapBlazor.Chart/css/bootstrap.blazor.chart.bundle.min.css">
<link rel="stylesheet" href="_content/BootstrapBlazor.Markdown/css/bootstrap.blazor.markdown.min.css">
<link rel="stylesheet" href="_content/BootstrapBlazor/css/bootstrap.blazor.min.css">
<link rel="stylesheet" href="_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css">
<link rel="stylesheet" href="_content/BootstrapBlazor.Shared/lib/highlight/vs.css">
<link rel="stylesheet" href="_content/BootstrapBlazor.Shared/css/site.css">
</head>

View File

@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsWebProject>true</IsWebProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="3.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="5.0.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,10 +1,10 @@
{
"Logging": {
"LogLevel": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
},
"AllowedHosts": "*"
}

View File

@@ -1,19 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<OutputType>Library</OutputType>
<RazorLangVersion>3.0</RazorLangVersion>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>true</IsPackable>
<PackageIcon>logo.png</PackageIcon>
<Version>3.1.29-beta02</Version>
<Version>5.0.4</Version>
<PackageReleaseNotes>更新日志https://gitee.com/LongbowEnterprise/BootstrapBlazor/wikis</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="3.1.9" />
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
@@ -23,7 +26,19 @@
<ItemGroup>
<Content Remove="bundleconfig.json" />
<Content Remove="wwwroot\css\bootstrap.blazor.css" />
<Content Remove="wwwroot\css\bootstrap.blazor.min.css" />
<Content Remove="wwwroot\js\bootstrap.blazor.js" />
<Content Remove="wwwroot\js\bootstrap.blazor.min.js" />
<Content Remove="wwwroot\lib\**\*.*" />
<Content Include="wwwroot\lib\font-awesome\fonts\*.*" />
<Content Include="wwwroot\lib\summernote\font\*.*" />
<None Include="bundleconfig.json" />
<None Include="wwwroot\css\bootstrap.blazor.css" />
<None Include="wwwroot\css\bootstrap.blazor.min.css" />
<None Include="wwwroot\js\bootstrap.blazor.js" />
<None Include="wwwroot\js\bootstrap.blazor.min.js" />
<None Include="wwwroot\lib\**\*.*" />
</ItemGroup>
<ItemGroup>

View File

@@ -0,0 +1,23 @@
namespace BootstrapBlazor.Components
{
/// <summary>
/// Delay 配置类
/// </summary>
public class BootstrapBlazorOptions
{
/// <summary>
/// 获得/设置 Toast 组件 Delay 默认值 默认为 0
/// </summary>
public int ToastDelay { get; set; }
/// <summary>
/// 获得/设置 Message 组件 Delay 默认值 默认为 0
/// </summary>
public int MessageDelay { get; set; }
/// <summary>
/// 获得/设置 Swal 组件 Delay 默认值 默认为 0
/// </summary>
public int SwalDelay { get; set; }
}
}

View File

@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Components.Rendering;
using Microsoft.AspNetCore.Components.Web;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
namespace BootstrapBlazor.Components
@@ -15,6 +16,7 @@ namespace BootstrapBlazor.Components
/// 获得/设置 TagName 属性 默认为 div
/// </summary>
[Parameter]
[NotNull]
public string? TagName { get; set; } = "div";
/// <summary>

View File

@@ -19,5 +19,10 @@
/// 获得/设置 自动隐藏时间间隔
/// </summary>
public int Delay { get; set; } = 4000;
/// <summary>
/// 获得/设置 是否强制使用本实例的延时时间,防止值被全局配置覆盖 默认 false
/// </summary>
public bool ForceDelay { get; set; }
}
}

View File

@@ -5,17 +5,17 @@
@if (ViewModel == CalendarViewModel.Month)
{
<div class="calendar-header">
<div class="calendar-title">@Title</div>
<div class="calendar-title">@GetTitle()</div>
<div class="calendar-button-group">
<div class="btn-group">
<button type="button" class="btn btn-sm" @onclick="e => OnChangeMonth(-1)">
<span>上个月</span>
<span>@PreviousMonth</span>
</button>
<button type="button" class="btn btn-sm" @onclick="e => OnChangeMonth(0)">
<span>今天</span>
<span>@Today</span>
</button>
<button type="button" class="btn btn-sm" @onclick="e => OnChangeMonth(1)">
<span>下个月</span>
<span>@NextMonth</span>
</button>
</div>
</div>
@@ -24,13 +24,10 @@
<table cellspacing="0" cellpadding="0" class="calendar-table">
<thead>
<tr>
<th>日</th>
<th>一</th>
<th></th>
<th>三</th>
<th>四</th>
<th>五</th>
<th>六</th>
@foreach (var w in WeekLists)
{
<th>@w</th>
}
</tr>
</thead>
<tbody>
@@ -39,7 +36,7 @@
<tr class="calendar-table-row">
@for (var index = 0; index < 7; index++)
{
<CalendarCell Value="@week.AddDays(index)" CurrentValue="@Value" OnClick="d => OnClickDay(d)" />
@RenderCell(new CalendarCell { Value = week.AddDays(index), CurrentValue = Value })
}
</tr>
}
@@ -50,17 +47,17 @@
else
{
<div class="calendar-header">
<div class="calendar-title"><span class="d-none d-sm-inline-block">@Title</span> <span>@Week</span></div>
<div class="calendar-title"><span class="d-none d-sm-inline-block">@GetTitle()</span> <span>@WeekNumberText</span></div>
<div class="calendar-button-group">
<div class="btn-group">
<button type="button" class="btn btn-sm" @onclick="e => OnChangeWeek(-7)">
<span>上一周</span>
<span>@PreviousWeek</span>
</button>
<button type="button" class="btn btn-sm" @onclick="e => OnChangeWeek(0)">
<span>本周</span>
<span>@WeekText</span>
</button>
<button type="button" class="btn btn-sm" @onclick="e => OnChangeWeek(7)">
<span>下一周</span>
<span>@NextWeek</span>
</button>
</div>
</div>
@@ -69,48 +66,10 @@
<table cellspacing="0" cellpadding="0" class="calendar-table table-week">
<thead>
<tr>
<th>
<div class="@GetWeekDayClassString(0)">
<div><span class="d-none d-sm-inline-block">周</span>日</div>
<div>@GetWeekDayString(0)</div>
</div>
</th>
<th>
<div class="@GetWeekDayClassString(1)">
<div><span class="d-none d-sm-inline-block">周</span>一</div>
<div>@GetWeekDayString(1)</div>
</div>
</th>
<th>
<div class="@GetWeekDayClassString(2)">
<div><span class="d-none d-sm-inline-block">周</span>二</div>
<div>@GetWeekDayString(2)</div>
</div>
</th>
<th>
<div class="@GetWeekDayClassString(3)">
<div><span class="d-none d-sm-inline-block">周</span>三</div>
<div>@GetWeekDayString(3)</div>
</div>
</th>
<th>
<div class="@GetWeekDayClassString(4)">
<div><span class="d-none d-sm-inline-block">周</span>四</div>
<div>@GetWeekDayString(4)</div>
</div>
</th>
<th>
<div class="@GetWeekDayClassString(5)">
<div><span class="d-none d-sm-inline-block">周</span>五</div>
<div>@GetWeekDayString(5)</div>
</div>
</th>
<th>
<div class="@GetWeekDayClassString(6)">
<div><span class="d-none d-sm-inline-block">周</span>六</div>
<div>@GetWeekDayString(6)</div>
</div>
</th>
@for (var index = 0; index < 7; index++)
{
@RenderWeekHeader(index)
}
</tr>
</thead>
<tbody>
@@ -119,4 +78,35 @@
</table>
</div>
}
</div>
</div>
@code {
record CalendarCell
{
public DateTime Value { get; init; }
public DateTime CurrentValue { get; init; }
}
private string? GetCalendarCellString(CalendarCell item) => CssBuilder.Default()
.AddClass("prev", item.Value.Month < item.CurrentValue.Month)
.AddClass("next", item.Value.Month > item.CurrentValue.Month)
.AddClass("current", item.Value.Month == item.CurrentValue.Month)
.AddClass("is-selected", item.Value.Ticks == item.CurrentValue.Ticks)
.AddClass("is-today", item.Value.Ticks == DateTime.Today.Ticks)
.Build();
RenderFragment<CalendarCell> RenderCell => item =>
@<td class="@GetCalendarCellString(item)" @onclick="@OnCellClickCallback(item.Value)">
<div class="calendar-day">
<span>@item.Value.Day</span>
</div>
</td>;
RenderFragment<int> RenderWeekHeader => index =>
@<th>
<div class="@GetWeekDayClassString(index)">
<div><span class="d-none d-sm-inline-block">@WeekHeaderText</span>@WeekLists.ElementAtOrDefault(index)</div>
<div>@GetWeekDayString(index)</div>
</div>
</th>;
}

View File

@@ -0,0 +1,77 @@
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading.Tasks;
namespace BootstrapBlazor.Components
{
/// <summary>
///
/// </summary>
public sealed partial class Calendar
{
[NotNull]
private string? PreviousMonth { get; set; }
[NotNull]
private string? NextMonth { get; set; }
[NotNull]
private string? Today { get; set; }
[NotNull]
private string? PreviousWeek { get; set; }
[NotNull]
private string? NextWeek { get; set; }
[NotNull]
private string? WeekText { get; set; }
[NotNull]
private List<string>? WeekLists { get; set; }
[NotNull]
private string? WeekHeaderText { get; set; }
[NotNull]
private List<string>? Months { get; set; }
/// <summary>
/// 获得 当前日历框年月
/// </summary>
private string? GetTitle() => Localizer["Title", Value.Year, Months.ElementAt(Value.Month - 1)];
/// <summary>
/// 获得 当前日历周文字
/// </summary>
[NotNull]
private string? WeekNumberText { get; set; }
[Inject]
[NotNull]
private IStringLocalizer<Calendar>? Localizer { get; set; }
/// <summary>
/// OnInitializedAsync 方法
/// </summary>
/// <returns></returns>
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
PreviousMonth = Localizer[nameof(PreviousMonth)];
NextMonth = Localizer[nameof(NextMonth)];
Today = Localizer[nameof(Today)];
WeekLists = Localizer[nameof(WeekLists)].Value.Split(',').ToList();
PreviousWeek = Localizer[nameof(PreviousWeek)];
NextWeek = Localizer[nameof(NextWeek)];
WeekText = Localizer[nameof(WeekText)];
WeekHeaderText = Localizer[nameof(WeekHeaderText)];
WeekNumberText = Localizer[nameof(WeekNumberText), GetWeekCount()];
Months = Localizer[nameof(Months)].Value.Split(',').ToList();
}
}
}

View File

@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using System;
using System.Globalization;
using System.Threading.Tasks;
namespace BootstrapBlazor.Components
{
@@ -10,16 +10,6 @@ namespace BootstrapBlazor.Components
/// </summary>
public abstract class CalendarBase : BootstrapComponentBase
{
/// <summary>
/// 获得 当前日历框年月
/// </summary>
protected string Title => $"{Value.Year} 年 {Value.Month} 月";
/// <summary>
/// 获得 当前日历周文字
/// </summary>
protected string Week => $"第 {GetWeekCount()} 周";
/// <summary>
/// 获得/设置 日历框开始时间
/// </summary>
@@ -91,13 +81,13 @@ namespace BootstrapBlazor.Components
/// <summary>
/// 选中日期时回调此方法
/// </summary>
/// <param name="d"></param>
protected async Task OnClickDay(DateTime d)
/// <param name="value"></param>
protected EventCallback<MouseEventArgs> OnCellClickCallback(DateTime value) => EventCallback.Factory.Create<MouseEventArgs>(this, async () =>
{
Value = d;
Value = value;
if (ValueChanged.HasDelegate) await ValueChanged.InvokeAsync(Value);
StateHasChanged();
}
});
/// <summary>
/// 右侧快捷切换月按钮回调此方法

View File

@@ -1,7 +0,0 @@
@namespace BootstrapBlazor.Components
<td class="@TableCellClass" @onclick="@OnClickDay">
<div class="calendar-day">
<span>@Text</span>
</div>
</td>

View File

@@ -1,49 +0,0 @@
using Microsoft.AspNetCore.Components;
using System;
using System.Threading.Tasks;
namespace BootstrapBlazor.Components
{
/// <summary>
/// CalendarCell 组件
/// </summary>
public sealed partial class CalendarCell
{
private string? TableCellClass => CssBuilder.Default()
.AddClass("prev", Value.Month < CurrentValue.Month)
.AddClass("next", Value.Month > CurrentValue.Month)
.AddClass("current", Value.Month == CurrentValue.Month)
.AddClass("is-selected", Value.Ticks == CurrentValue.Ticks)
.AddClass("is-today", Value.Ticks == DateTime.Today.Ticks)
.Build();
/// <summary>
/// 获取 日视图下日单元格显示文字
/// </summary>
/// <returns></returns>
private string Text => $"{Value.Day}";
/// <summary>
/// 获得/设置 组件值
/// </summary>
[Parameter]
public DateTime Value { get; set; }
/// <summary>
/// 获得/设置 组件值
/// </summary>
[Parameter]
public DateTime CurrentValue { get; set; }
/// <summary>
///
/// </summary>
[Parameter]
public Func<DateTime, Task>? OnClick { get; set; }
private async Task OnClickDay()
{
if (OnClick != null) await OnClick.Invoke(Value);
}
}
}

View File

@@ -1,6 +1,8 @@
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading.Tasks;
namespace BootstrapBlazor.Components
@@ -45,7 +47,7 @@ namespace BootstrapBlazor.Components
/// 获得 Images 集合
/// </summary>
[Parameter]
public IEnumerable<string>? Images { get; set; }
public IEnumerable<string> Images { get; set; } = Enumerable.Empty<string>();
/// <summary>
/// 获得/设置 内部图片的宽度

View File

@@ -94,13 +94,15 @@ namespace BootstrapBlazor.Components
{
var t = typeValue.GenericTypeArguments;
var instance = Activator.CreateInstance(typeof(List<>).MakeGenericType(t));
var mi = instance.GetType().GetMethod("AddRange");
if (mi != null)
if (instance != null)
{
mi.Invoke(instance, new object[] { Value });
var mi = instance.GetType().GetMethod("AddRange");
if (mi != null)
{
mi.Invoke(instance, new object[] { Value });
}
list = instance as IList;
}
list = instance as IList;
}
if (list != null)
{
@@ -149,14 +151,17 @@ namespace BootstrapBlazor.Components
else if (typeValue.IsGenericType)
{
var t = typeValue.GenericTypeArguments;
var instance = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(t));
var instance = Activator.CreateInstance(typeof(List<>).MakeGenericType(t)) as IList;
foreach (var model in Items.Where(i => GetChecked(i)))
if (instance != null)
{
var val = GetValue<object>(model);
instance.Add(val);
foreach (var model in Items.Where(i => GetChecked(i)))
{
var val = GetValue<object>(model);
instance.Add(val);
}
CurrentValue = (TValue)instance;
}
CurrentValue = (TValue)instance;
}
if (OnSelectedChanged != null) await OnSelectedChanged.Invoke(Items, item, Value);

View File

@@ -3,6 +3,20 @@
<div @attributes="@AdditionalAttributes" class="@ClassName">
<div class="picker-panel-body-wrapper">
@if (ShowSidebar)
{
<div class="picker-panel-sidebar">
<div class="sidebar-item">
<DatePickerCell Value="@DateTime.Today" Text="@Today" OnClick="@(async d => await OnClickShortLink(d))" />
</div>
<div class="sidebar-item">
<DatePickerCell Value="@DateTime.Today.AddDays(-1)" Text="@Yesterday" OnClick="@(async d => await OnClickShortLink(d))" />
</div>
<div class="sidebar-item">
<DatePickerCell Value="@DateTime.Today.AddDays(-7)" Text="@Weekago" OnClick="@(async d => await OnClickShortLink(d))" />
</div>
</div>
}
<div class="picker-panel-body">
<div class="@DateTimeViewClassName">
<span class="date-picker-editor-wrap">
@@ -14,22 +28,28 @@
</span>
</div>
<div class="date-picker-header">
<button type="button" aria-label="@AiraPrevYearLabel" class="picker-panel-icon-btn" @onclick="@OnClickPrevYear">
<i class="fa fa-angle-double-left"></i>
</button>
<button type="button" aria-label="@AiraPrevMonthLabel" class="@PrevMonthClassName" @onclick="@OnClickPrevMonth">
<i class="fa fa-angle-left"></i>
</button>
@if (ShowLeftButtons)
{
<button type="button" aria-label="@AiraPrevYearLabel" class="picker-panel-icon-btn" @onclick="@OnClickPrevYear">
<i class="fa fa-angle-double-left"></i>
</button>
<button type="button" aria-label="@AiraPrevMonthLabel" class="@PrevMonthClassName" @onclick="@OnClickPrevMonth">
<i class="fa fa-angle-left"></i>
</button>
}
<div class="d-flex align-items-center justify-content-center flex-fill">
<span role="button" class="date-picker-header-label" @onclick="e => SwitchView(DatePickerViewModel.Year)">@YearString</span>
<span role="button" class="@CurrentMonthViewClassName" @onclick="e => SwitchView(DatePickerViewModel.Month)">@MonthString</span>
<DynamicElement TagName="span" role="button" class="date-picker-header-label" TriggerClick="@(!IsRange)" OnClick="@(() => SwitchView(DatePickerViewModel.Year))">@YearString</DynamicElement>
<DynamicElement TagName="span" role="button" class="@CurrentMonthViewClassName" TriggerClick="@(!IsRange)" OnClick="@(() => SwitchView(DatePickerViewModel.Month))">@MonthString</DynamicElement>
</div>
<button type="button" aria-label="@AiraNextMonthLabel" class="@NextMonthClassName" @onclick="@OnClickNextMonth">
<i class="fa fa-angle-right"></i>
</button>
<button type="button" aria-label="@AiraNextYearLabel" class="picker-panel-icon-btn" @onclick="@OnClickNextYear">
<i class="fa fa-angle-double-right"></i>
</button>
@if (ShowRightButtons)
{
<button type="button" aria-label="@AiraNextMonthLabel" class="@NextMonthClassName" @onclick="@OnClickNextMonth">
<i class="fa fa-angle-right"></i>
</button>
<button type="button" aria-label="@AiraNextYearLabel" class="picker-panel-icon-btn" @onclick="@OnClickNextYear">
<i class="fa fa-angle-double-right"></i>
</button>
}
</div>
<div class="picker-panel-content">
<table cellspacing="0" cellpadding="0" class="@DateViewClassName">
@@ -47,7 +67,7 @@
{
<td class="@GetDayClass(week.AddDays(index))">
<div>
<DatePickerCell Value="@week.AddDays(index)" Text="@GetDayText(week.AddDays(index).Day)" OnClick="@(d=> OnClickDateTime(d))" />
<DatePickerCell Value="@week.AddDays(index)" Text="@GetDayText(week.AddDays(index).Day)" OnClick="@(async d => await OnClickDateTime(d))" />
</div>
</td>
}
@@ -92,20 +112,26 @@
</div>
</div>
</div>
<div class="picker-panel-footer">
<div class="flex-fill">
@if (AllowNull)
@if (ShowFooter)
{
<div class="picker-panel-footer">
<div class="flex-fill">
@if (AllowNull)
{
<button type="button" class="btn picker-panel-link-btn is-confirm" @onclick="@ClickClearButton">
<span>@ClearButtonText</span>
</button>
}
</div>
@if (MinValue == null && MaxValue == null)
{
<button type="button" class="btn picker-panel-link-btn is-confirm" @onclick="@ClickClearButton">
<span>@ClearButtonText</span>
<button type="button" class="btn picker-panel-link-btn is-now" @onclick="@ClickNowButton">
<span>@NowButtonText</span>
</button>
}
<button type="button" class="btn picker-panel-link-btn is-confirm" @onclick="@ClickConfirmButton">
<span>@ConfirmButtonText</span>
</button>
</div>
<button type="button" class="btn picker-panel-link-btn is-now" @onclick="@ClickNowButton">
<span>@NowButtonText</span>
</button>
<button type="button" class="btn picker-panel-link-btn is-confirm" @onclick="@ClickConfirmButton">
<span>@ConfirmButtonText</span>
</button>
</div>
}
</div>

View File

@@ -64,8 +64,12 @@ namespace BootstrapBlazor.Components
private string? GetDayClass(DateTime day) => CssBuilder.Default("")
.AddClass("prev-month", day.Month < CurrentDate.Month)
.AddClass("next-month", day.Month > CurrentDate.Month)
.AddClass("current", day.Ticks == CurrentDate.Ticks)
.AddClass("today", day.Ticks == DateTime.Today.Ticks)
.AddClass("current", day == CurrentDate && !IsRange)
.AddClass("start", IsRange && day == Ranger!.SelectedValue.Start)
.AddClass("end", IsRange && day == Ranger!.SelectedValue!.End)
.AddClass("range", IsRange && CurrentDate.Month >= Ranger!.SelectedValue.Start.Month && (Ranger!.SelectedValue.Start != DateTime.MinValue) && (Ranger!.SelectedValue.End != DateTime.MinValue) && (day.Ticks >= Ranger!.SelectedValue.Start.Ticks) && (day.Ticks <= Ranger!.SelectedValue.End.Ticks))
.AddClass("today", day == DateTime.Today)
.AddClass("disabled", (MinValue != null && MaxValue != null) && (day < MinValue || day > MaxValue))
.Build();
/// <summary>
@@ -147,6 +151,8 @@ namespace BootstrapBlazor.Components
/// </summary>
private string? TimeValueString => CurrentTime.ToString(TimeFormat);
private bool IsRange { get; set; }
/// <summary>
/// 获得/设置 组件显示模式 默认为显示年月日模式
/// </summary>
@@ -165,6 +171,30 @@ namespace BootstrapBlazor.Components
[NotNull]
public string? DateFormat { get; set; }
/// <summary>
/// 获得/设置 是否显示快捷侧边栏 默认不显示
/// </summary>
[Parameter]
public bool ShowSidebar { get; set; }
/// <summary>
/// 获得/设置 是否显示左侧控制按钮 默认显示
/// </summary>
[Parameter]
public bool ShowLeftButtons { get; set; } = true;
/// <summary>
/// 获得/设置 是否显示右侧控制按钮 默认显示
/// </summary>
[Parameter]
public bool ShowRightButtons { get; set; } = true;
/// <summary>
/// 获得/设置 是否显示 Footer 区域 默认为 true 显示
/// </summary>
[Parameter]
public bool ShowFooter { get; set; } = true;
/// <summary>
/// 获得/设置 时间格式字符串 默认为 "hh\\:mm\\:ss"
/// </summary>
@@ -251,6 +281,24 @@ namespace BootstrapBlazor.Components
[Parameter]
public EventCallback<DateTime> ValueChanged { get; set; }
/// <summary>
/// 获得/设置 当前日期最大值
/// </summary>
[Parameter]
public DateTime? MaxValue { get; set; }
/// <summary>
/// 获得/设置 当前日期最小值
/// </summary>
[Parameter]
public DateTime? MinValue { get; set; }
/// <summary>
/// 获得/设置 是否为 Range 内使用 默认为 false
/// </summary>
[CascadingParameter]
public DateTimeRange? Ranger { get; set; }
[Inject]
[NotNull]
private IStringLocalizer<DateTimePicker<DateTime>>? Localizer { get; set; }
@@ -276,6 +324,15 @@ namespace BootstrapBlazor.Components
[NotNull]
private List<string>? WeekLists { get; set; }
[NotNull]
private string? Today { get; set; }
[NotNull]
private string? Yesterday { get; set; }
[NotNull]
private string? Weekago { get; set; }
/// <summary>
/// OnInitialized 方法
/// </summary>
@@ -283,8 +340,9 @@ namespace BootstrapBlazor.Components
{
base.OnInitialized();
CurrentViewModel = ViewModel;
IsRange = Ranger != null;
CurrentViewModel = ViewModel;
// 计算开始与结束时间 每个组件显示 6 周数据
if (Value == DateTime.MinValue)
@@ -312,6 +370,10 @@ namespace BootstrapBlazor.Components
MonthLists = Localizer[nameof(MonthLists)].Value.Split(',').ToList();
Months = Localizer[nameof(Months)].Value.Split(',').ToList();
WeekLists = Localizer[nameof(WeekLists)].Value.Split(',').ToList();
Today ??= Localizer[nameof(Today)];
Yesterday ??= Localizer[nameof(Yesterday)];
Weekago ??= Localizer[nameof(Weekago)];
}
/// <summary>
@@ -321,6 +383,7 @@ namespace BootstrapBlazor.Components
{
ShowTimePicker = false;
CurrentDate = CurrentViewModel == DatePickerViewModel.Year ? CurrentDate.AddYears(-20) : CurrentDate.AddYears(-1);
Ranger?.UpdateStart(CurrentDate);
}
/// <summary>
@@ -330,6 +393,7 @@ namespace BootstrapBlazor.Components
{
ShowTimePicker = false;
CurrentDate = CurrentDate.AddMonths(-1);
Ranger?.UpdateStart(CurrentDate);
}
/// <summary>
@@ -339,6 +403,7 @@ namespace BootstrapBlazor.Components
{
ShowTimePicker = false;
CurrentDate = CurrentViewModel == DatePickerViewModel.Year ? CurrentDate.AddYears(20) : CurrentDate.AddYears(1);
Ranger?.UpdateEnd(CurrentDate);
}
/// <summary>
@@ -348,28 +413,42 @@ namespace BootstrapBlazor.Components
{
ShowTimePicker = false;
CurrentDate = CurrentDate.AddMonths(1);
Ranger?.UpdateEnd(CurrentDate);
}
/// <summary>
/// Day 选择时触发此方法
/// </summary>
/// <param name="d"></param>
private Task OnClickDateTime(DateTime d)
private async Task OnClickDateTime(DateTime d)
{
ShowTimePicker = false;
CurrentDate = d;
StateHasChanged();
return Task.CompletedTask;
Ranger?.UpdateValue(d);
if (!IsRange)
{
if (!ShowFooter) await ClickConfirmButton();
StateHasChanged();
}
}
private async Task OnClickShortLink(DateTime d)
{
await OnClickDateTime(d);
if (ShowFooter) await ClickConfirmButton();
}
/// <summary>
/// 设置组件显示视图方法
/// </summary>
/// <param name="view"></param>
private void SwitchView(DatePickerViewModel view)
private Task SwitchView(DatePickerViewModel view)
{
ShowTimePicker = false;
CurrentViewModel = view;
StateHasChanged();
return Task.CompletedTask;
}
/// <summary>
@@ -379,10 +458,8 @@ namespace BootstrapBlazor.Components
/// <param name="d"></param>
private void SwitchView(DatePickerViewModel view, DateTime d)
{
ShowTimePicker = false;
CurrentViewModel = view;
CurrentDate = d;
StateHasChanged();
SwitchView(view);
}
/// <summary>
@@ -439,7 +516,7 @@ namespace BootstrapBlazor.Components
/// </summary>
/// <param name="day"></param>
/// <returns></returns>
private string? GetDayText(int day) => $"{day}";
private static string? GetDayText(int day) => $"{day}";
/// <summary>
/// 获取 月视图下月份单元格显示文字
@@ -456,15 +533,14 @@ namespace BootstrapBlazor.Components
/// <summary>
/// 点击 此刻时调用此方法
/// </summary>
private Task ClickNowButton()
private async Task ClickNowButton()
{
ShowTimePicker = false;
Value = ViewModel switch
{
DatePickerViewModel.DateTime => DateTime.Now,
_ => DateTime.Today
};
return Task.CompletedTask;
await ClickConfirmButton();
}
/// <summary>

View File

@@ -1,4 +1,4 @@
@namespace BootstrapBlazor.Components
@inherits BootstrapComponentBase
<span @attributes="@AdditionalAttributes" class="cell" @onclick="e => OnClick?.Invoke(Value)">@Text</span>
<span @attributes="@AdditionalAttributes" class="cell" @onclick="e => OnClick(Value)">@Text</span>

View File

@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Components;
using System;
using System.Diagnostics.CodeAnalysis;
namespace BootstrapBlazor.Components
{
@@ -18,12 +19,14 @@ namespace BootstrapBlazor.Components
/// 获得/设置 日期
/// </summary>
[Parameter]
[NotNull]
public string? Text { get; set; }
/// <summary>
/// 获得/设置 按钮点击回调方法
/// </summary>
[Parameter]
[NotNull]
public Action<DateTime>? OnClick { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More