|
11 | 11 | <div class="@ToolbarClassString"> |
12 | 12 | @foreach (var button in _buttons) |
13 | 13 | { |
14 | | - @if (button is TableToolbarButton<TItem> b && b.IsShow) |
| 14 | + @if (button is TableToolbarButton<TItem> { IsShow: true } b) |
15 | 15 | { |
16 | 16 | <Button AdditionalAttributes="b.AdditionalAttributes" Size="b.Size" |
17 | 17 | Color="@b.Color" Icon="@b.Icon" Text="@b.Text" IsAsync="@b.IsAsync" |
18 | 18 | OnClickWithoutRender="() => OnToolbarButtonClick(b)" |
19 | 19 | TooltipText="@b.TooltipText" TooltipPlacement="@b.TooltipPlacement" TooltipTrigger="@b.TooltipTrigger" |
20 | 20 | IsDisabled="GetDisabled(b)"></Button> |
21 | 21 | } |
22 | | - else if (button is TableToolbarPopConfirmButton<TItem> pb && pb.IsShow) |
| 22 | + else if (button is TableToolbarPopConfirmButton<TItem> { IsShow: true } pb) |
23 | 23 | { |
24 | 24 | <PopConfirmButton AdditionalAttributes="pb.AdditionalAttributes" CustomClass="@pb.CustomClass" |
25 | 25 | Color="@pb.Color" Icon="@pb.Icon" Text="@pb.Text" Size="pb.Size" ShowShadow="@pb.ShowShadow" |
|
31 | 31 | CloseButtonText="@pb.CloseButtonText" Content="@pb.Content"> |
32 | 32 | </PopConfirmButton> |
33 | 33 | } |
34 | | - else if (button is TableToolbarComponent<TItem> cb && cb.IsShow) |
| 34 | + else if (button is TableToolbarComponent<TItem> { IsShow: true } cb) |
35 | 35 | { |
36 | 36 | <CascadingValue Value="OnGetSelectedRows" IsFixed="true"> |
37 | 37 | @cb.ChildContent |
|
48 | 48 | <div class="dropdown-menu"> |
49 | 49 | @foreach (var button in _buttons) |
50 | 50 | { |
51 | | - @if (button is TableToolbarButton<TItem> { IsShow: true } b) |
| 51 | + @switch (button) |
52 | 52 | { |
53 | | - <div class="dropdown-item" @onclick="e => OnToolbarButtonClick(b)"> |
54 | | - @if (string.IsNullOrEmpty(b.Icon)) |
55 | | - { |
56 | | - <span>@b.Text</span> |
57 | | - } |
58 | | - else |
59 | | - { |
60 | | - <i class="@b.Icon"></i> |
61 | | - } |
62 | | - </div> |
63 | | - } |
64 | | - else if (button is TableToolbarPopConfirmButton<TItem> { IsShow: true } pb) |
65 | | - { |
66 | | - <div class="dropdown-item" @onclick="pb.OnConfirm"> |
67 | | - @if (string.IsNullOrEmpty(pb.Icon)) |
68 | | - { |
69 | | - <span>@pb.Text</span> |
70 | | - } |
71 | | - else |
72 | | - { |
73 | | - <i class="@pb.Icon"></i> |
74 | | - } |
75 | | - </div> |
| 53 | + case TableToolbarButton<TItem> { IsShow: true } b: |
| 54 | + { |
| 55 | + <DynamicElement class="@GetItemClass(b)" TriggerClick="!GetDisabled(b)" OnClick="() => OnToolbarButtonClick(b)"> |
| 56 | + @if (string.IsNullOrEmpty(b.Icon)) |
| 57 | + { |
| 58 | + <span>@b.Text</span> |
| 59 | + } |
| 60 | + else |
| 61 | + { |
| 62 | + <i class="@b.Icon"></i> |
| 63 | + } |
| 64 | + </DynamicElement> |
| 65 | + break; |
| 66 | + } |
| 67 | + case TableToolbarPopConfirmButton<TItem> { IsShow: true } pb: |
| 68 | + { |
| 69 | + <DynamicElement class="@GetItemClass(pb)" TriggerClick="!GetDisabled(pb)" OnClick="pb.OnConfirm"> |
| 70 | + @if (string.IsNullOrEmpty(pb.Icon)) |
| 71 | + { |
| 72 | + <span>@pb.Text</span> |
| 73 | + } |
| 74 | + else |
| 75 | + { |
| 76 | + <i class="@pb.Icon"></i> |
| 77 | + } |
| 78 | + </DynamicElement> |
| 79 | + break; |
| 80 | + } |
76 | 81 | } |
77 | 82 | } |
78 | 83 | </div> |
|
0 commit comments