Refactor signature popup handling in ReportViewer
Simplified the `OpenSignaturePopupAsync` method by converting it to a synchronous `void` method and removing unnecessary asynchronous calls. Introduced a new `OnPopupShownAsync` method to handle popup initialization logic. Updated the `<Popup>` component to include the `Shown="OnPopupShownAsync"` attribute and re-added the `CloseOnOutsideClick="false"` attribute. Improved the logic for opening the signature popup by setting the active tab and resetting validation messages inline. Enhanced the `OnAfterRenderAsync` lifecycle method to include additional checks for `Report`, annotations, and signature state before triggering JavaScript runtime calls. These changes improve the popup's behavior and overall state management.
This commit is contained in:
@@ -96,7 +96,8 @@ Width="620px"
|
|||||||
ShowFooter="true"
|
ShowFooter="true"
|
||||||
CloseOnEscape="false"
|
CloseOnEscape="false"
|
||||||
ShowCloseButton="false"
|
ShowCloseButton="false"
|
||||||
CloseOnOutsideClick="false">
|
CloseOnOutsideClick="false"
|
||||||
|
Shown="OnPopupShownAsync">
|
||||||
<BodyContentTemplate>
|
<BodyContentTemplate>
|
||||||
<ul class="nav nav-tabs mb-3">
|
<ul class="nav nav-tabs mb-3">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
@@ -235,7 +236,10 @@ CloseOnOutsideClick="false">
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await OpenSignaturePopupAsync();
|
ActiveSignatureTab = SignatureTabDraw;
|
||||||
|
SignaturePopupVisible = true;
|
||||||
|
SignatureValidationMessage = null;
|
||||||
|
PopupValidationMessage = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,6 +259,7 @@ CloseOnOutsideClick="false">
|
|||||||
if (firstRender)
|
if (firstRender)
|
||||||
_dotNetRef = DotNetObjectReference.Create(this);
|
_dotNetRef = DotNetObjectReference.Create(this);
|
||||||
|
|
||||||
|
|
||||||
if (Report is not null && _annotations.Count > 0
|
if (Report is not null && _annotations.Count > 0
|
||||||
&& _capturedSignature is not null && !SignatureApplied
|
&& _capturedSignature is not null && !SignatureApplied
|
||||||
&& _lastOverlayViewerKey != ViewerKey) {
|
&& _lastOverlayViewerKey != ViewerKey) {
|
||||||
@@ -274,13 +279,14 @@ CloseOnOutsideClick="false">
|
|||||||
await InvokeAsync(StateHasChanged);
|
await InvokeAsync(StateHasChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task OpenSignaturePopupAsync() {
|
void OpenSignaturePopupAsync() {
|
||||||
ActiveSignatureTab = SignatureTabDraw;
|
ActiveSignatureTab = SignatureTabDraw;
|
||||||
SignaturePopupVisible = true;
|
SignaturePopupVisible = true;
|
||||||
SignatureValidationMessage = null;
|
SignatureValidationMessage = null;
|
||||||
PopupValidationMessage = null;
|
PopupValidationMessage = null;
|
||||||
await InvokeAsync(StateHasChanged);
|
}
|
||||||
await Task.Delay(50);
|
|
||||||
|
async Task OnPopupShownAsync() {
|
||||||
await InitializeActiveSignatureTabAsync();
|
await InitializeActiveSignatureTabAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user