FormWizard, FormWizardStep - fixed not showing steps in certain conditions, DatePicker - code cleanup, showing selected month and year
This commit is contained in:
parent
f9ba559480
commit
b67973cb68
@ -1,5 +1,4 @@
|
||||
using Connected.Utilities;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Connected.Components;
|
||||
public partial class DatePicker
|
||||
@ -131,17 +130,17 @@ public partial class DatePicker
|
||||
public string MonthChipClass(int month)
|
||||
{
|
||||
if (month.CompareTo(SelectedDate.Month) == 0)
|
||||
return "bg-info text-white";
|
||||
return "active";
|
||||
else
|
||||
return "bg-core text-light";
|
||||
return "";
|
||||
}
|
||||
|
||||
public string YearChipClass(int year)
|
||||
{
|
||||
if (year.CompareTo(SelectedDate.Year) == 0)
|
||||
return "bg-info text-white";
|
||||
return "active";
|
||||
else
|
||||
return "bg-core text-light";
|
||||
return "";
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
@ -153,32 +152,6 @@ public partial class DatePicker
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
private string NavBarClass
|
||||
{
|
||||
get
|
||||
{
|
||||
return new CssBuilder("text-justify")
|
||||
.AddClass("text-md-justify")
|
||||
//.AddClass("bg-warning")
|
||||
.AddClass("p-2")
|
||||
.AddClass("text-small")
|
||||
.AddClass("text-dark")
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
|
||||
private string NavBarStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
return new StyleBuilder("display","flex")
|
||||
.AddStyle("flex-direction","row")
|
||||
.AddStyle("flex-wrap","nowrap")
|
||||
.AddStyle("justify-content","space-between")
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ClosePicker(bool resetDate=true)
|
||||
{
|
||||
if (resetDate)
|
||||
|
@ -207,13 +207,14 @@ public partial class FormWizard
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
/*protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (Steps is not null)
|
||||
if (Steps is null) Steps = new();
|
||||
Steps.Clear();
|
||||
InitializeSteps();
|
||||
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
}*/
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
|
@ -9,8 +9,11 @@ public partial class FormWizardStep
|
||||
[CascadingParameter]
|
||||
public FormWizard Parent { get; set; }
|
||||
|
||||
[Parameter, EditorRequired]
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Unique name of the step (used for properly identifying steps)
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public string? Id { get; set; } = Guid.NewGuid().ToString();
|
||||
|
||||
/// <summary>
|
||||
/// Text shown inside the button
|
||||
@ -88,10 +91,17 @@ public partial class FormWizardStep
|
||||
|
||||
#region Lifecycle
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
private bool ItemExists()
|
||||
{
|
||||
Parent.Steps.Add(this);
|
||||
if (Parent.Steps.Where(step => step.Id.Equals(this.Id)).Count() > 0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (!ItemExists())
|
||||
Parent.Steps.Add(this);
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user