@@ -72,10 +84,17 @@
}
case (Selecting.Days):
{
-
-
+
+
+
await NavBarClick(false))">
+
+
Selecting = Selecting.Months)>@SelectedDate.ToString("MMMM yyyy")
-
+
+
+
+
await NavBarClick())">
+
@for (int i = 0; i < 7; i++)
@@ -93,16 +112,19 @@
{
}
-
CalendarStart = CalendarStart.AddDays(1);
}
break;
}
}
-
-
-
-
+ @if (ShowBottomBar)
+ {
+
+
+
+
+
+ }
}
diff --git a/src/Connected.Components/Components/DatePicker.razor.cs b/src/Connected.Components/Components/DatePicker.razor.cs
index 676bedd..0aebe9f 100644
--- a/src/Connected.Components/Components/DatePicker.razor.cs
+++ b/src/Connected.Components/Components/DatePicker.razor.cs
@@ -32,6 +32,9 @@ public partial class DatePicker
[Parameter]
public bool UseDateRange { get; set; } = false;
+ [Parameter]
+ public bool ShowBottomBar { get; set; } = false;
+
[Parameter]
public string Format { get; set; } = "dd.MM.yyyy";
@@ -50,13 +53,14 @@ public partial class DatePicker
}
private bool Shown { get; set; } = false;
- public async Task SetDate(DateTime Date)
+ public async Task SetDate(DateTime Date, bool HideOnSet=false)
{
SelectedDate = Date;
SetStartStop();
if (CloseOnDateSelect)
Shown = false;
await SelectedDateChanged.InvokeAsync(SelectedDate);
+ if (HideOnSet) Shown = false;
StateHasChanged();
}
@@ -168,17 +172,17 @@ public partial class DatePicker
public string MonthChipClass(int month)
{
if (month.CompareTo(SelectedDate.Month) == 0)
- return "bg-info text-light";
+ return "bg-info text-white";
else
- return "bg-core text-dark";
+ return "bg-core text-light";
}
public string YearChipClass(int year)
{
if (year.CompareTo(SelectedDate.Year) == 0)
- return "bg-info text-light";
+ return "bg-info text-white";
else
- return "bg-core text-dark";
+ return "bg-core text-light";
}
protected override async Task OnInitializedAsync()
@@ -196,12 +200,51 @@ public partial class DatePicker
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 NavBarClick(bool forward = true)
+ {
+ int multiplier = 1;
+ if (!forward) multiplier = -1;
+ switch (Selecting)
+ {
+ case Selecting.Years:
+ {
+ SelectedDate=SelectedDate.AddYears(8 * multiplier);
+ break;
+ }
+ case Selecting.Months:
+ {
+ SelectedDate = SelectedDate.AddYears(1 * multiplier);
+ break;
+ }
+ case Selecting.Days:
+ {
+ SelectedDate = SelectedDate.AddMonths(1*multiplier);
+ break;
+ }
+ }
+ SetStartStop();
+ await InvokeAsync(StateHasChanged);
+ }
+
}
public enum Selecting