fix(module: tree): add ComponentBase (#956)

This commit is contained in:
James Yeung 2021-01-10 18:49:52 +08:00 committed by GitHub
parent 3582075e22
commit 9a5cbb9255
10 changed files with 15 additions and 22 deletions

View File

@ -1,4 +1,5 @@
@namespace AntDesign
@inherits ComponentBase
@typeparam TItem
<span class="ant-tree-indent" aria-hidden="true">

View File

@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Components;
namespace AntDesign
{
public partial class TreeIndent<TItem>
public partial class TreeIndent<TItem> : ComponentBase
{
/// <summary>
/// 树控件本身
@ -21,7 +21,5 @@ namespace AntDesign
[Parameter]
public int TreeLevel { get; set; }
}
}

View File

@ -5,7 +5,7 @@
@if (RealDisplay)
{
<CascadingValue Value="this" Name="SelfNode">
<div @key="NodeId" class="@TreeNodeClassMapper.Class">
<div @key="NodeId" class="@ClassMapper.Class" style="@Style">
<TreeIndent TreeLevel="@TreeLevel" TItem="TItem"></TreeIndent>
@ -20,7 +20,6 @@
}
<TreeNodeTitle TItem="TItem"></TreeNodeTitle>
</div>
</CascadingValue>
}
@ -36,4 +35,4 @@
{
@Nodes
}
</CascadingValue>
</CascadingValue>

View File

@ -188,11 +188,9 @@ namespace AntDesign
[Parameter]
public bool Loading { get; set; }
protected ClassMapper TreeNodeClassMapper { get; } = new ClassMapper();
private void SetTreeNodeClassMapper()
{
TreeNodeClassMapper.Clear().Add("ant-tree-treenode")
ClassMapper.Clear().Add("ant-tree-treenode")
.If("ant-tree-treenode-disabled", () => Disabled)
.If("ant-tree-treenode-switcher-open", () => SwitcherOpen)
.If("ant-tree-treenode-switcher-close", () => SwitcherClose)

View File

@ -1,10 +1,8 @@
@namespace AntDesign
@inherits AntDomComponentBase
@inherits ComponentBase
@typeparam TItem
<span class="@ClassMapper.Class" @onclick="OnClick">
<span class="ant-tree-checkbox-inner">
</span>
<span class="@ClassMapper.Class" @onclick="OnClick">
<span class="ant-tree-checkbox-inner">
</span>
</span>

View File

@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Components.Web;
namespace AntDesign
{
public partial class TreeNodeCheckbox<TItem> : AntDomComponentBase
public partial class TreeNodeCheckbox<TItem> : ComponentBase
{
/// <summary>
/// 树控件本身

View File

@ -1,5 +1,5 @@
@namespace AntDesign
@inherits AntDomComponentBase
@inherits ComponentBase
@typeparam TItem
<span class="@ClassMapper.Class" @onclick="OnClick">

View File

@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Components.Web;
namespace AntDesign
{
public partial class TreeNodeSwitcher<TItem> : AntDomComponentBase
public partial class TreeNodeSwitcher<TItem> : ComponentBase
{
/// <summary>
/// 树控件本身

View File

@ -1,5 +1,5 @@
@namespace AntDesign
@inherits AntDomComponentBase
@inherits ComponentBase
@typeparam TItem
<span class="@TitleClassMapper.Class" title="@SelfNode.Title" @onclick="OnClick" @ondblclick="OnDblClick" draggable="@CanDraggable" aria-grabbed="@CanDraggable">
@ -33,5 +33,4 @@
@SelfNode.Title
</span>
}
</span>
</span>

View File

@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Components.Web;
namespace AntDesign
{
public partial class TreeNodeTitle<TItem> : AntDomComponentBase
public partial class TreeNodeTitle<TItem> : ComponentBase
{
/// <summary>
/// 树控件本身