2020-04-16 20:53:03 +08:00
|
|
|
@namespace AntBlazor
|
2020-04-16 12:05:59 +08:00
|
|
|
@inherits AntDomComponentBase
|
|
|
|
<CascadingValue Value="this">
|
|
|
|
@ChildContent
|
|
|
|
</CascadingValue>
|
|
|
|
|
2020-04-23 17:13:56 +08:00
|
|
|
<div class="@ClassMapper.Class" style="@Style" id="@Id">
|
2020-04-16 12:05:59 +08:00
|
|
|
<!---->
|
|
|
|
@if (TabBarExtraContent != null)
|
|
|
|
{
|
|
|
|
<div class="ant-tabs-extra-content" style="float: right;">
|
|
|
|
@TabBarExtraContent
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
|
|
|
|
@if (TabPosition != AntTabPosition.Bottom)
|
|
|
|
{
|
|
|
|
<!--Tab bar-->
|
|
|
|
<div tabindex="-1" class="@_barClassMapper.Class" role="tablist">
|
|
|
|
<div class="@_navClassMapper.Class">
|
|
|
|
<span class="@_prevClassMapper.Class" unselectable="unselectable" @onclick="OnPrevClicked">
|
|
|
|
<span class="ant-tabs-tab-prev-icon">
|
|
|
|
<AntIcon class="ant-tabs-tab-prev-icon-target" type="@(TabPosition == AntTabPosition.Top || TabPosition == AntTabPosition.Bottom?"left":"up")" />
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
<span class="@_nextClassMapper.Class" unselectable="unselectable" @onclick="OnNextClicked">
|
|
|
|
<span class="ant-tabs-tab-next-icon">
|
|
|
|
<AntIcon class="ant-tabs-tab-next-icon-target" type="@(TabPosition == AntTabPosition.Top || TabPosition == AntTabPosition.Bottom?"right":"down")" />
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
<div class="ant-tabs-nav-wrap" @ref="_scrollTabBar">
|
|
|
|
<div class="ant-tabs-nav-scroll">
|
|
|
|
<div class="ant-tabs-nav ant-tabs-nav-animated" style="@_navStyle">
|
|
|
|
<div @ref="_tabBars">
|
2020-04-24 18:32:50 +08:00
|
|
|
@foreach (var pane in _panes)
|
2020-04-16 12:05:59 +08:00
|
|
|
{
|
|
|
|
if (pane.IsActive)
|
|
|
|
{
|
2020-04-23 17:13:56 +08:00
|
|
|
<div @ref="_activeTabBar" tabindex="0" class="@pane._classMapper.Class" id="tab-@pane.Key" role="tab"
|
2020-04-16 20:53:03 +08:00
|
|
|
aria-disabled="@pane.Disabled" aria-selected="true" aria-controls="tabpane-@pane.Key"
|
|
|
|
draggable="@Draggable.ToString()"
|
|
|
|
@ondragover:preventDefault
|
|
|
|
ondragover="event.preventDefault();"
|
|
|
|
@ondragstart="(e)=>HandleDragStart(e, pane)"
|
2020-04-24 18:32:50 +08:00
|
|
|
@ondrop="(e)=>HandleDrop(pane)">
|
2020-04-16 12:05:59 +08:00
|
|
|
@if (Type == AntTabType.EditableCard && pane.Closable)
|
|
|
|
{
|
|
|
|
<div>
|
|
|
|
@pane.Tab
|
|
|
|
<AntIcon class="ant-tabs-close-x" type="close" @onclick="(e)=>RemoveTabPane(pane)" />
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
@pane.Tab
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-04-16 20:53:03 +08:00
|
|
|
<div tabindex="-1" class="ant-tabs-tab" id="tab-@pane.Key" role="tab"
|
|
|
|
aria-disabled="@pane.Disabled" aria-selected="false" aria-controls="tabpane-@pane.Key"
|
|
|
|
@onclick="(e)=>ActivatePane(pane)" @onclick:stopPropagation
|
|
|
|
draggable="@Draggable.ToString()"
|
|
|
|
ondragover="event.preventDefault();"
|
|
|
|
@ondragstart="(e)=>HandleDragStart(e, pane)"
|
2020-04-24 18:32:50 +08:00
|
|
|
@ondrop="(e)=>HandleDrop(pane)">
|
2020-04-16 12:05:59 +08:00
|
|
|
@if (Type == AntTabType.EditableCard && pane.Closable)
|
|
|
|
{
|
|
|
|
<div>
|
|
|
|
@pane.Tab
|
|
|
|
<AntIcon class="ant-tabs-close-x" type="close" @onclick="(e)=>RemoveTabPane(pane)" />
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
@pane.Tab
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
<div class="ant-tabs-ink-bar ant-tabs-ink-bar-animated" style="@_inkStyle"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
<!--Tab content-->
|
|
|
|
<div class="ant-tabs-content ant-tabs-@TabPosition-content ant-tabs-@Type-content ant-tabs-content-animated" style="@_contentStyle">
|
2020-04-24 18:32:50 +08:00
|
|
|
@foreach (var pane in _panes)
|
2020-04-16 12:05:59 +08:00
|
|
|
{
|
|
|
|
@if (pane.IsActive)
|
|
|
|
{
|
|
|
|
<div role="tabpanel" aria-hidden="false" tabindex="0" class="ant-tabs-tabpane ant-tabs-tabpane-active" style="visibility: visible;">@pane.ChildContent</div>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<div role="tabpanel" aria-hidden="true" tabindex="-1" class="ant-tabs-tabpane ant-tabs-tabpane-inactive" style="visibility: hidden;">@pane.ChildContent</div>
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
@if (TabPosition == AntTabPosition.Bottom)
|
|
|
|
{
|
|
|
|
<!--Tab bar-->
|
|
|
|
<div tabindex="-1" class="@_barClassMapper.Class" role="tablist">
|
|
|
|
<div class="@_navClassMapper.Class">
|
|
|
|
<span class="@_prevClassMapper.Class" unselectable="unselectable" @onclick="OnPrevClicked">
|
|
|
|
<span class="ant-tabs-tab-prev-icon">
|
|
|
|
<AntIcon class="ant-tabs-tab-prev-icon-target" type="@(TabPosition == AntTabPosition.Top || TabPosition == AntTabPosition.Bottom?"left":"up")" />
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
<span class="@_nextClassMapper.Class" unselectable="unselectable" @onclick="OnNextClicked">
|
|
|
|
<span class="ant-tabs-tab-next-icon">
|
|
|
|
<AntIcon class="ant-tabs-tab-next-icon-target" type="@(TabPosition == AntTabPosition.Top || TabPosition == AntTabPosition.Bottom?"right":"down")" />
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
<div class="ant-tabs-nav-wrap" @ref="_scrollTabBar">
|
|
|
|
<div class="ant-tabs-nav-scroll">
|
|
|
|
<div class="ant-tabs-nav ant-tabs-nav-animated" style="@_navStyle">
|
|
|
|
<div @ref="_tabBars">
|
2020-04-24 18:32:50 +08:00
|
|
|
@foreach (var pane in _panes)
|
2020-04-16 12:05:59 +08:00
|
|
|
{
|
|
|
|
if (pane.IsActive)
|
|
|
|
{
|
2020-04-23 17:13:56 +08:00
|
|
|
<div @ref="_activeTabBar" tabindex="0" class="@pane._classMapper.Class" id="tab-@pane.Key" role="tab"
|
2020-04-16 20:53:03 +08:00
|
|
|
aria-disabled="@pane.Disabled" aria-selected="true" aria-controls="tabpane-@pane.Key"
|
|
|
|
draggable="@Draggable.ToString()"
|
|
|
|
@ondragover:preventDefault
|
|
|
|
ondragover="event.preventDefault();"
|
|
|
|
@ondragstart="(e)=>HandleDragStart(e, pane)"
|
2020-04-24 18:32:50 +08:00
|
|
|
@ondrop="(e)=>HandleDrop(pane)">
|
2020-04-16 12:05:59 +08:00
|
|
|
@if (Type == AntTabType.EditableCard && pane.Closable)
|
|
|
|
{
|
|
|
|
<div>
|
|
|
|
@pane.Tab
|
|
|
|
<AntIcon class="ant-tabs-close-x" type="close" @onclick="(e)=>RemoveTabPane(pane)" />
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
@pane.Tab
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-04-16 20:53:03 +08:00
|
|
|
<div tabindex="-1" class="ant-tabs-tab" id="tab-@pane.Key" role="tab"
|
|
|
|
aria-disabled="@pane.Disabled" aria-selected="false" aria-controls="tabpane-@pane.Key"
|
|
|
|
@onclick="(e)=>ActivatePane(pane)" @onclick:stopPropagation
|
|
|
|
draggable="@Draggable.ToString()"
|
|
|
|
ondragover="event.preventDefault();"
|
|
|
|
@ondragstart="(e)=>HandleDragStart(e, pane)"
|
2020-04-24 18:32:50 +08:00
|
|
|
@ondrop="(e)=>HandleDrop(pane)">
|
2020-04-16 12:05:59 +08:00
|
|
|
@if (Type == AntTabType.EditableCard && pane.Closable)
|
|
|
|
{
|
|
|
|
<div>
|
|
|
|
@pane.Tab
|
|
|
|
<AntIcon class="ant-tabs-close-x" type="close" @onclick="(e)=>RemoveTabPane(pane)" />
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
@pane.Tab
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
<div class="ant-tabs-ink-bar ant-tabs-ink-bar-animated" style="@_inkStyle"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
2020-04-16 20:53:03 +08:00
|
|
|
</div>
|