Rework for Tabstrip regression issue
Fix for Tabpanel is not updating the UI. #4778 #4828
This commit is contained in:
@ -242,7 +242,6 @@
|
||||
|
||||
private async Task SaveModule()
|
||||
{
|
||||
|
||||
validated = true;
|
||||
var interop = new Interop(JSRuntime);
|
||||
if (await interop.FormValid(form))
|
||||
@ -302,13 +301,13 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
//_activetab = "Settings";
|
||||
_activetab = "Settings";
|
||||
AddModuleMessage(Localizer["Message.Required.Title"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//_activetab = "Settings";
|
||||
_activetab = "Settings";
|
||||
AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
|
@ -469,6 +469,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
_activetab = "Settings";
|
||||
AddModuleMessage(Localizer["Message.Required.PageInfo"], MessageType.Warning);
|
||||
}
|
||||
|
||||
@ -476,11 +477,13 @@
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving Page {Page} {Error}", page, ex.Message);
|
||||
_activetab = "Settings";
|
||||
AddModuleMessage(Localizer["Error.Page.Save"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_activetab = "Settings";
|
||||
AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
|
@ -673,7 +673,6 @@
|
||||
else
|
||||
{
|
||||
_activetab = "Settings";
|
||||
_refresh = true;
|
||||
AddModuleMessage(Localizer["Message.Required.PageInfo"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
@ -681,14 +680,12 @@
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving Page {Page} {Error}", _page, ex.Message);
|
||||
_activetab = "Settings";
|
||||
_refresh = true;
|
||||
AddModuleMessage(Localizer["Error.Page.Save"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_activetab = "Settings";
|
||||
_refresh = true;
|
||||
AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
@inject IStringLocalizer<SharedResources> SharedLocalizer
|
||||
|
||||
<div class="quill-text-editor">
|
||||
<TabStrip ActiveTab="@_activetab">
|
||||
<TabStrip ActiveTab="@_activetab" TabChangeEvent=false>
|
||||
@if (_allowRichText)
|
||||
{
|
||||
<TabPanel Name="Rich" Heading="Rich Text Editor" ResourceKey="RichTextEditor">
|
||||
|
@ -10,13 +10,13 @@
|
||||
<li class="nav-item" @key="tabPanel.Name">
|
||||
@if (tabPanel.Name.ToLower() == ActiveTab.ToLower())
|
||||
{
|
||||
<a class="nav-link active" data-bs-toggle="tab" href="#@(Id + tabPanel.Name)" role="tab" @onclick:preventDefault="true">
|
||||
<a class="nav-link active" data-bs-toggle="tab" href="#@(Id + tabPanel.Name)" role="tab" @onclick="() => { if (TabChangeEvent) ChangeTab(tabPanel.Name); }">
|
||||
@tabPanel.DisplayHeading()
|
||||
</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a class="nav-link" data-bs-toggle="tab" href="#@(Id + tabPanel.Name)" role="tab" @onclick:preventDefault="true">
|
||||
<a class="nav-link" data-bs-toggle="tab" href="#@(Id + tabPanel.Name)" role="tab" @onclick="() => { if (TabChangeEvent) ChangeTab(tabPanel.Name); }">
|
||||
@tabPanel.DisplayHeading()
|
||||
</a>
|
||||
}
|
||||
@ -38,6 +38,9 @@
|
||||
[Parameter]
|
||||
public RenderFragment ChildContent { get; set; } // contains the TabPanels
|
||||
|
||||
[Parameter]
|
||||
public bool TabChangeEvent { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public string ActiveTab { get; set; } // optional - defaults to first TabPanel if not specified. Can also be set using a "tab=" querystring parameter.
|
||||
|
||||
@ -55,7 +58,7 @@
|
||||
if (string.IsNullOrEmpty(Id))
|
||||
{
|
||||
// create unique id for component
|
||||
Id = "TabStrip_" + Guid.NewGuid().ToString("N") + "_" ;
|
||||
Id = "TabStrip_" + Guid.NewGuid().ToString("N") + "_";
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,6 +72,7 @@
|
||||
{
|
||||
_tabPanels = new List<TabPanel>();
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
internal void AddTabPanel(TabPanel tabPanel)
|
||||
@ -110,4 +114,13 @@
|
||||
}
|
||||
return authorized;
|
||||
}
|
||||
|
||||
private void ChangeTab(string tabName)
|
||||
{
|
||||
if (ActiveTab != tabName)
|
||||
{
|
||||
ActiveTab = tabName;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user