ant-design-blazor/components/tabs/Tabs.razor

74 lines
3.6 KiB
C#
Raw Normal View History

@namespace AntDesign
@inherits AntDomComponentBase
feat(module: overlay): OverlayTrigger not bound to a div (#937) * feat(module:overlay): OverlayTrigger not bound to a div * feat(module:overlay): OverlayTrigger not bound to a div * feat(module:overlay): Logic transfer to single Overlay * feat(module:overlay): remove obsolete duplication * feat(module:Tooltip): Add for unbounded oncontextmenu event handler * feat(module:tooltip): unbound js event listeners remove * docs(module:tooltip): unbound explanation * fix(module:button): attach Ref to top level html element @ref * feat(module:dropdown&tooltip&popconfirm&popover): Overlay not bound to a div * docs(module:dropdown&tooltip&popconfirm&popover): unbound explanation * feat(module:OverlayTrigger): common logic relocation * feat(module:overlaytrigger): Overlay not bound to a div * feat(module:DatePicker): Overlay not bound to a div * feat(module:select): Overlay not boud to div * fix(module:select): onclickarrow event relocation * fix(module:select): rename Show to OnArrowClick * feat(module:avatar): Overlay not bound to a div * docs(module:avatar): demo switch to unbound version * feat(module:autocomplete): partial OverlayTrigger not bound to a div * feat(module:slider): tooltip * docs(module:slider): tooltip * fix(module:overlay): add SetVisible method * feat: set Ref where missing, performance components register Ref when missing IsFixed flag for CascadeValue changed hard-code sequence numbers when using RenderTreeBuilder Rate component use Tooltip Unbound version Tabs test fix * fix: revert changes (accidental) * feat(module:upload): tooltip with unbound usage * feat(module:table): column use of unbound tooltip * feat(module:autocomplete):overlay unbound from div * fix(module:upload): missing div restore Co-authored-by: James Yeung <shunjiey@hotmail.com>
2021-01-21 17:20:10 +08:00
<CascadingValue Value="this" IsFixed="@true">
<CascadingValue Value="true" Name="IsEmpty" IsFixed="true">
@ChildContent
</CascadingValue>
<div class="@ClassMapper.Class" style="@Style" id="@Id">
<!--Tab bar-->
<div role="tablist" class="ant-tabs-nav">
<div class="ant-tabs-nav-wrap @_tabsNavWarpPingClass" @ref="@_tabBars">
<div class="ant-tabs-nav-list" style="@_navStyle" @ref="@_scrollTabBar">
<CascadingValue Value="true" Name="IsTab" IsFixed="true">
@foreach (var pane in _panes)
{
<CascadingValue Value="pane" Name="Pane" @key="pane.Key">
@ChildContent
</CascadingValue>
}
</CascadingValue>
@if (Type == TabType.EditableCard && !HideAdd)
{
<button type="button" class="ant-tabs-nav-add" aria-label="Add tab" @onclick="OnAddClick">
<Icon Type="plus" />
</button>
}
<div class="ant-tabs-ink-bar ant-tabs-ink-bar-animated" style="@_inkStyle"></div>
</div>
</div>
@if (TabBarExtraContent != null || (Card?.Extra != null && Card?.Title == null && Card?.TitleTemplate == null))
{
<div class="ant-tabs-extra-content">
@(TabBarExtraContent?? Card?.Extra)
</div>
}
<Dropdown>
<Overlay>
<ul tabindex="0" class="ant-tabs-dropdown-menu ant-tabs-dropdown-menu-root ant-tabs-dropdown-menu-vertical" id="@($"rc-tabs-{Id}-more-popup")" role="listbox" aria-label="expanded dropdown">
@foreach (var pane in _panes.Where(p => !p.IsActive))
{
<li class="ant-tabs-dropdown-menu-item @(pane.Disabled?$"ant-tabs-dropdown-menu-item-disabled":string.Empty)" id="@($"rc-tabs-{Id}-more-popup-{pane.Key}")" role="option" aria-disabled="false" aria-selected="false" aria-controls="@($"rc-tabs-{Id}-more-popup-{pane.Key}")"
@onclick="(e)=>HandleTabClick(pane)">@pane.Tab</li>
}
</ul>
</Overlay>
<ChildContent>
<div class="@_operationClass" @onclick:preventDefault>
<button tabindex="-1" class="ant-tabs-nav-more" id="rc-tabs-0-more" aria-expanded="false" aria-haspopup="listbox" aria-hidden="true" aria-controls="rc-tabs-0-more-popup"
style="@_operationStyle" type="button">
<Icon Type="ellipsis" />
</button>
</div>
</ChildContent>
</Dropdown>
</div>
<!--Tab content-->
@if (Card == null)
{
<div class="ant-tabs-content-holder ">
<div class="ant-tabs-content ant-tabs-content-@TabPosition">
<CascadingValue Value="true" Name="IsPane" IsFixed="true">
@foreach (var pane in _panes)
{
<CascadingValue Value="pane" Name="Pane">
@ChildContent
</CascadingValue>
}
</CascadingValue>
</div>
</div>
}
</div>
</CascadingValue>