|
|
|
@ -1,8 +1,7 @@
|
|
|
|
|
using Connected.Enums;
|
|
|
|
|
using Connected.Utilities;
|
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Reflection.Metadata;
|
|
|
|
|
|
|
|
|
|
namespace Connected.Components;
|
|
|
|
|
public partial class FormWizard
|
|
|
|
@ -16,11 +15,26 @@ public partial class FormWizard
|
|
|
|
|
[Parameter]
|
|
|
|
|
public RenderFragment? ChildContent { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Steps of type FormWizardStep
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Parameter]
|
|
|
|
|
public List<FormWizardStep> Steps { get; set; } = new();
|
|
|
|
|
|
|
|
|
|
[Parameter, EditorRequired]
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// EventCallback for 'Finish' button click
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Parameter]
|
|
|
|
|
public EventCallback OnFinishedClick { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// EventCallback for 'Cancel' button click
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Parameter]
|
|
|
|
|
public EventCallback OnCancelClick { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public string Id { get; set; } = Guid.NewGuid().ToString();
|
|
|
|
|
|
|
|
|
|
private string NextBtnText = "Next";
|
|
|
|
|
private string PreviousBtnText = "Previous";
|
|
|
|
@ -50,7 +64,7 @@ public partial class FormWizard
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (ActiveIndex>0)
|
|
|
|
|
if (ActiveIndex > 0)
|
|
|
|
|
return ActiveIndex - 1;
|
|
|
|
|
return ActiveIndex;
|
|
|
|
|
}
|
|
|
|
@ -62,10 +76,11 @@ public partial class FormWizard
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (ActiveIndex < StepCount-1)
|
|
|
|
|
if (ActiveIndex < StepCount - 1)
|
|
|
|
|
return ActiveIndex + 1;
|
|
|
|
|
return ActiveIndex;
|
|
|
|
|
} catch
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
return ActiveIndex;
|
|
|
|
|
}
|
|
|
|
@ -80,38 +95,17 @@ public partial class FormWizard
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void NextSlide()
|
|
|
|
|
private async Task NextSlide()
|
|
|
|
|
{
|
|
|
|
|
if (NextBtnText.ToLower().Equals("finish"))
|
|
|
|
|
{
|
|
|
|
|
FinishedState = FinishedState.Finished;
|
|
|
|
|
Steps[ActiveIndex].Completed = true;
|
|
|
|
|
WizardFinished = true;
|
|
|
|
|
await OnFinishedClick.InvokeAsync();
|
|
|
|
|
}
|
|
|
|
|
if (FinishedState.Equals(FinishedState.Unfinished))
|
|
|
|
|
{
|
|
|
|
|
/*if (ActiveIndex < StepCount)
|
|
|
|
|
{
|
|
|
|
|
Steps[ActiveIndex].Completed = true;
|
|
|
|
|
ResetValuesForChild(ActiveIndex);
|
|
|
|
|
if (ActiveIndex < StepCount)
|
|
|
|
|
ResetValuesForChild(NextIndex);
|
|
|
|
|
if (ActiveIndex > 0)
|
|
|
|
|
ResetValuesForChild(PreviousIndex);
|
|
|
|
|
|
|
|
|
|
ActiveIndex = NextIndex;
|
|
|
|
|
Steps[ActiveIndex].Active = true;
|
|
|
|
|
Steps[PreviousIndex].IsPrevious = true;
|
|
|
|
|
if (ActiveIndex != NextIndex)
|
|
|
|
|
Steps[NextIndex].IsNext = true;
|
|
|
|
|
else Steps[NextIndex].IsNext = false;
|
|
|
|
|
|
|
|
|
|
if (ActiveIndex == NextIndex)
|
|
|
|
|
NextBtnText = "Finish";
|
|
|
|
|
else
|
|
|
|
|
NextBtnText = "Next";
|
|
|
|
|
StateHasChanged();
|
|
|
|
|
}*/
|
|
|
|
|
Steps[ActiveIndex].Completed = true;
|
|
|
|
|
Steps[ActiveIndex].Active = false;
|
|
|
|
|
Steps[PreviousIndex].IsPrevious = false;
|
|
|
|
@ -132,7 +126,6 @@ public partial class FormWizard
|
|
|
|
|
{
|
|
|
|
|
if (ActiveIndex > 0)
|
|
|
|
|
{
|
|
|
|
|
//Steps[ActiveIndex].Completed = true;
|
|
|
|
|
Steps[ActiveIndex].Active = false;
|
|
|
|
|
Steps[PreviousIndex].IsPrevious = false;
|
|
|
|
|
Steps[ActiveIndex].IsNext = false;
|
|
|
|
@ -146,13 +139,18 @@ public partial class FormWizard
|
|
|
|
|
else
|
|
|
|
|
NextBtnText = "Next";
|
|
|
|
|
}
|
|
|
|
|
if (ActiveIndex==0)
|
|
|
|
|
if (ActiveIndex == 0)
|
|
|
|
|
{
|
|
|
|
|
ResetAllChildren();
|
|
|
|
|
Steps[ActiveIndex].Active = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task CancelClick()
|
|
|
|
|
{
|
|
|
|
|
await OnCancelClick.InvokeAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public string Class { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
@ -201,10 +199,10 @@ public partial class FormWizard
|
|
|
|
|
ResetAllChildren();
|
|
|
|
|
Steps[ActiveIndex].Active = true;
|
|
|
|
|
|
|
|
|
|
if (ActiveIndex!=0)
|
|
|
|
|
if (ActiveIndex != 0)
|
|
|
|
|
{
|
|
|
|
|
Steps[ActiveIndex].IsNext = true;
|
|
|
|
|
Steps[PreviousIndex].IsPrevious= true;
|
|
|
|
|
Steps[PreviousIndex].IsPrevious = true;
|
|
|
|
|
}
|
|
|
|
|
StateHasChanged();
|
|
|
|
|
}
|
|
|
|
@ -212,7 +210,7 @@ public partial class FormWizard
|
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
|
|
|
{
|
|
|
|
|
if (Steps is not null)
|
|
|
|
|
Steps.Clear();
|
|
|
|
|
Steps.Clear();
|
|
|
|
|
|
|
|
|
|
await base.OnParametersSetAsync();
|
|
|
|
|
}
|
|
|
|
|