-
-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Table): add TableToolbarComponent (#2799)
* refactor: 更新 input-group btn-group 样式 * feat: 支持自定义组件 * feat: 增加 OnGetSelectedRows 级联传参 * chore: bump version 8.1.7-beta01 * test: 更新单元测试 * feat: 拆分接口 * test: 增加单元测试 * test: 增加异常单元测试
- Loading branch information
Showing
11 changed files
with
186 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
// Website: https://www.blazor.zone or https://argozhang.github.io/ | ||
|
||
namespace BootstrapBlazor.Components; | ||
|
||
/// <summary> | ||
/// 工具栏按钮接口 | ||
/// </summary> | ||
public interface IToolbarComponent<TItem> | ||
{ | ||
/// <summary> | ||
/// 获得/设置 是否显示 默认 true 显示 | ||
/// </summary> | ||
bool IsShow { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/BootstrapBlazor/Components/Table/TableToolbarComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
// Website: https://www.blazor.zone or https://argozhang.github.io/ | ||
|
||
namespace BootstrapBlazor.Components; | ||
|
||
/// <summary> | ||
/// Table 工具栏自定义组件 | ||
/// </summary> | ||
public class TableToolbarComponent<TItem> : ComponentBase, IToolbarComponent<TItem>, IDisposable | ||
{ | ||
/// <summary> | ||
/// <inheritdoc/> | ||
/// </summary> | ||
[Parameter] | ||
public bool IsShow { get; set; } = true; | ||
|
||
/// <summary> | ||
/// 获得/设置 子组件 | ||
/// </summary> | ||
[Parameter] | ||
public RenderFragment? ChildContent { get; set; } | ||
|
||
/// <summary> | ||
/// 获得/设置 Table Toolbar 实例 | ||
/// </summary> | ||
[CascadingParameter] | ||
protected TableToolbar<TItem>? Toolbar { get; set; } | ||
|
||
/// <summary> | ||
/// <inheritdoc/> | ||
/// </summary> | ||
protected override void OnInitialized() | ||
{ | ||
base.OnInitialized(); | ||
|
||
Toolbar?.AddButton(this); | ||
} | ||
|
||
/// <summary> | ||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously. | ||
/// </summary> | ||
/// <param name="disposing"></param> | ||
protected virtual void Dispose(bool disposing) | ||
{ | ||
if (disposing) | ||
{ | ||
Toolbar?.RemoveButton(this); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// <inheritdoc/> | ||
/// </summary> | ||
public void Dispose() | ||
{ | ||
Dispose(true); | ||
GC.SuppressFinalize(this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters