mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-15 09:21:24 +08:00
b5d3758e5e
* feat(module: tabs): update tabs header & inker * feat(module: tabs): update content holder * feat(module: tabs): update disabled tab pane * feat(module: tabs): upgrade to component demo * feat(module: tabs): add operation button * feat(module: tabs): add operation drop down * fix(module: tabs): operation visibility * feat(module: tabs): scroll tab bar * fix: remove button and extra content Co-authored-by: ElderJames <shunjiey@hotmail.com>
81 lines
2.0 KiB
C#
81 lines
2.0 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace AntDesign
|
|
{
|
|
public partial class TabPane : AntDomComponentBase
|
|
{
|
|
private const string PrefixCls = "ant-tabs-tab";
|
|
private Tabs _parent;
|
|
|
|
internal ClassMapper _classMapper = new ClassMapper();
|
|
|
|
internal bool IsActive { get; set; }
|
|
|
|
public TabPane()
|
|
{
|
|
}
|
|
|
|
public TabPane(string key, RenderFragment tab, RenderFragment childContent)
|
|
{
|
|
this.Key = key;
|
|
this.Tab = tab;
|
|
this.ChildContent = childContent;
|
|
}
|
|
|
|
[CascadingParameter]
|
|
internal Tabs Parent
|
|
{
|
|
get
|
|
{
|
|
return _parent;
|
|
}
|
|
set
|
|
{
|
|
if (_parent == null)
|
|
{
|
|
_parent = value;
|
|
_parent.AddTabPane(this);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Forced render of content in tabs, not lazy render after clicking on tabs
|
|
/// </summary>
|
|
[Parameter]
|
|
public bool ForceRender { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// TabPane's key
|
|
/// </summary>
|
|
[Parameter]
|
|
public string Key { get; set; }
|
|
|
|
/// <summary>
|
|
/// Show text in <see cref="TabPane"/>'s head
|
|
/// </summary>
|
|
[Parameter]
|
|
public RenderFragment Tab { get; set; }
|
|
|
|
[Parameter]
|
|
public RenderFragment ChildContent { get; set; }
|
|
|
|
[Parameter]
|
|
public bool Disabled { get; set; }
|
|
|
|
[Parameter]
|
|
public bool Closable { get; set; } = true;
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
base.OnParametersSet();
|
|
|
|
_classMapper.Clear().
|
|
Add(PrefixCls)
|
|
.If($"{PrefixCls}-active", () => IsActive)
|
|
.If($"{PrefixCls}-with-remove", () => Closable)
|
|
.If($"{PrefixCls}-disabled", () => Disabled);
|
|
}
|
|
}
|
|
}
|