|
45 | 45 | }
|
46 | 46 | @foreach (var item in Items)
|
47 | 47 | {
|
48 |
| - if (item.HeaderTemplate != null) |
| 48 | + @if (item.HeaderTemplate != null) |
49 | 49 | {
|
50 | 50 | @item.HeaderTemplate(item)
|
51 | 51 | }
|
52 | 52 | else if (item.IsDisabled)
|
53 | 53 | {
|
54 |
| - <div role="tab" class="@GetClassString(item)"> |
55 |
| - @if (!string.IsNullOrEmpty(item.Icon)) |
56 |
| - { |
57 |
| - <i class="@GetIconClassString(item.Icon)"></i> |
58 |
| - } |
59 |
| - <span class="tabs-item-text">@item.Text</span> |
60 |
| - </div> |
| 54 | + @RenderDisabledHeaderByStyle(item) |
61 | 55 | }
|
62 | 56 | else
|
63 | 57 | {
|
64 |
| - <a @key="item" href="@item.Url" role="tab" tabindex="-1" class="@GetClassString(item)" @onclick="@(() => OnClickTabItem(item))" @onclick:preventDefault="@(!ClickTabToNavigation)" draggable="@DraggableString"> |
65 |
| - @if (!string.IsNullOrEmpty(item.Icon)) |
66 |
| - { |
67 |
| - <i class="@GetIconClassString(item.Icon)"></i> |
68 |
| - } |
69 |
| - <span class="tabs-item-text">@item.Text</span> |
70 |
| - @if (ShowFullScreen && item.ShowFullScreen) |
71 |
| - { |
72 |
| - <FullScreenButton TargetId="@GetIdByTabItem(item)"></FullScreenButton> |
73 |
| - } |
74 |
| - @if (ShowClose && item.Closable) |
75 |
| - { |
76 |
| - <span class="tabs-item-close" @onclick:stopPropagation @onclick:preventDefault @onclick="() => RemoveTab(item)"> |
77 |
| - <i class="@CloseIcon"></i> |
78 |
| - </span> |
79 |
| - } |
80 |
| - </a> |
| 58 | + @RenderHeaderByStyle(item) |
81 | 59 | }
|
82 | 60 | }
|
83 | 61 | @if (IsCard || IsBorderCard)
|
@@ -145,4 +123,54 @@ else
|
145 | 123 | @<CascadingValue Value="item" IsFixed="true">
|
146 | 124 | @RenderTabItemContent(item)
|
147 | 125 | </CascadingValue>;
|
| 126 | + |
| 127 | + RenderFragment RenderChromeDisabledHeader(TabItem item) => |
| 128 | + @<div @key="@item" class="@GetItemWrapClassString(item)"> |
| 129 | + <div role="tab" class="@GetClassString(item)"> |
| 130 | + @RenderHeaderContent(item) |
| 131 | + </div> |
| 132 | + <i class="tab-corner tab-corner-left"></i> |
| 133 | + <i class="tab-corner tab-corner-right"></i> |
| 134 | + </div>; |
| 135 | + |
| 136 | + RenderFragment RenderDefaultDisabledHeader(TabItem item) => |
| 137 | + @<div @key="item" role="tab" class="@GetClassString(item)"> |
| 138 | + @RenderHeaderContent(item) |
| 139 | + </div>; |
| 140 | + |
| 141 | + RenderFragment RenderChromeHeader(TabItem item) => |
| 142 | + @<div @key="@item" class="@GetItemWrapClassString(item)"> |
| 143 | + <a href="@item.Url" role="tab" tabindex="-1" class="@GetClassString(item)" @onclick="@(() => OnClickTabItem(item))" @onclick:preventDefault="@(!ClickTabToNavigation)" draggable="@DraggableString"> |
| 144 | + @RenderHeaderContent(item) |
| 145 | + </a> |
| 146 | + <i class="tab-corner tab-corner-left"></i> |
| 147 | + <i class="tab-corner tab-corner-right"></i> |
| 148 | + </div>; |
| 149 | + |
| 150 | + RenderFragment RenderDefaultHeader(TabItem item) => |
| 151 | + @<a @key="item" href="@item.Url" role="tab" tabindex="-1" class="@GetClassString(item)" @onclick="@(() => OnClickTabItem(item))" @onclick:preventDefault="@(!ClickTabToNavigation)" draggable="@DraggableString"> |
| 152 | + @RenderHeaderContent(item) |
| 153 | + </a>; |
| 154 | + |
| 155 | + RenderFragment RenderHeaderContent(TabItem item) => |
| 156 | + @<div class="tabs-item-body"> |
| 157 | + @if (!string.IsNullOrEmpty(item.Icon)) |
| 158 | + { |
| 159 | + <i class="@GetIconClassString(item.Icon)"></i> |
| 160 | + } |
| 161 | + <span class="tabs-item-text">@item.Text</span> |
| 162 | + @if (!item.IsDisabled) |
| 163 | + { |
| 164 | + @if (ShowFullScreen && item.ShowFullScreen) |
| 165 | + { |
| 166 | + <FullScreenButton TargetId="@GetIdByTabItem(item)"></FullScreenButton> |
| 167 | + } |
| 168 | + @if (ShowClose && item.Closable) |
| 169 | + { |
| 170 | + <span class="tabs-item-close" @onclick:stopPropagation @onclick:preventDefault @onclick="() => RemoveTab(item)"> |
| 171 | + <i class="@CloseIcon"></i> |
| 172 | + </span> |
| 173 | + } |
| 174 | + } |
| 175 | + </div>; |
148 | 176 | }
|
0 commit comments