123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- @using System.IO;
- <div class="fr-webreport-tabs">
- @for (int i = 0; i < WebReport.Tabs.Count; i++)
- {
- int copyIndex = i;
- string active = (copyIndex == WebReport.CurrentTabIndex ? "active" : "");
- <div class="fr-webreport-tab @active">
- <a class="fr-webreport-tab-title" @onclick="() => SetTab(copyIndex)">
- @WebReport.GetTabName(copyIndex)
- </a>
- @if (WebReport.Tabs[copyIndex].Closeable)
- {
- <a class="fr-webreport-tab-close" title="Close" @onclick="() => CloseTab(copyIndex)">
- <img src="_content/FastReport.Web/Resources/close.svg"/>
- </a>
- }
- </div>
- }
- </div>
- @code {
- [Parameter]
- public WebReport WebReport { get; set; }
- private void SetTab(int i)
- {
- if(i != WebReport.CurrentTabIndex)
- {
- WebReport.SetTab(i);
- WebReport.OnUpdate(false);
- }
- }
- private void CloseTab(int i)
- {
- var activeTab = WebReport.CurrentTab;
- WebReport.Tabs[i].Report.Dispose();
- WebReport.Tabs.RemoveAt(i);
- if (activeTab == null)
- {
- WebReport.CurrentTabIndex = 0;
- }
- else
- {
- for (int j = 0; j < WebReport.Tabs.Count; j++)
- if (WebReport.Tabs[j] == activeTab)
- {
- WebReport.CurrentTabIndex = j;
- break;
- }
- }
- WebReport.OnUpdate(false);
- }
- }
|