From fa33cc518924b0be191120af30548de0c29a55be Mon Sep 17 00:00:00 2001 From: markosteger Date: Tue, 7 Mar 2023 12:27:46 +0100 Subject: [PATCH 01/12] DatePicker - minor fixes, added methods for back ind forward click in header (selecting year, month..) --- .../Components/DatePicker.razor | 56 +++++++++++++------ .../Components/DatePicker.razor.cs | 53 ++++++++++++++++-- 2 files changed, 87 insertions(+), 22 deletions(-) diff --git a/src/Connected.Components/Components/DatePicker.razor b/src/Connected.Components/Components/DatePicker.razor index e369771..f59ddc5 100644 --- a/src/Connected.Components/Components/DatePicker.razor +++ b/src/Connected.Components/Components/DatePicker.razor @@ -21,16 +21,21 @@ { case Selecting.Years: { -
-
-
Selecting = Selecting.Months)>@SelectedDate.ToString("yyyy")
-
+
+
+
+
+
Selecting = Selecting.Months)>@SelectedDate.ToString("MMMM yyyy")
+ +
+
+
@for (int i = SelectedDate.Year - 7; i < SelectedDate.Year + 8; i++) { int y = i; -
+
@i.ToString()
@@ -46,15 +51,22 @@ } case Selecting.Months: { -
-
+
+
+
+
+
Selecting = Selecting.Years)>@SelectedDate.ToString("MMMM yyyy")
-
+ + +
+
+
@for (int i = 1; i <= @DateTimeFormatInfo.CurrentInfo.MonthNames.Length - 1; i++) { int m = i; -
+
@@ -72,10 +84,17 @@ } case (Selecting.Days): { -
-
+
+
+
+
+
Selecting = Selecting.Months)>@SelectedDate.ToString("MMMM yyyy")
-
+ + +
+
+
@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 From 602c61568c18b3309aa066ce1fff2e9972211784 Mon Sep 17 00:00:00 2001 From: markosteger Date: Tue, 7 Mar 2023 12:28:00 +0100 Subject: [PATCH 02/12] DatePicker - index file --- .../Pages/Index.razor | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/src/Connected.Components.Showcase.Runner/Pages/Index.razor b/src/Connected.Components.Showcase.Runner/Pages/Index.razor index 3205f94..99ffedd 100644 --- a/src/Connected.Components.Showcase.Runner/Pages/Index.razor +++ b/src/Connected.Components.Showcase.Runner/Pages/Index.razor @@ -4,30 +4,11 @@

Component Sandbox

- - - Step1 - - - Step2 - - - Step3 - - - Step4 - - - + - -

Selected date is @date.ToString()

- -@value +

Izbran datum je: @date

@code { DateTime date = DateTime.Today; From 516c4f337eed85aaf658cebf354071753ea31351 Mon Sep 17 00:00:00 2001 From: markosteger Date: Thu, 9 Mar 2023 12:44:10 +0100 Subject: [PATCH 03/12] Grid, GridRow, GridRowContent --- .gitignore | 5 ++ .../Pages/Democomp.razor | 13 +++-- .../Program.cs | 20 -------- .../Components/Grid.razor | 5 ++ .../Components/Grid.razor.cs | 41 ++++++++++++++++ .../Components/GridRow.razor | 23 +++++++++ .../Components/GridRow.razor.cs | 48 +++++++++++++++++++ .../Components/GridRowContent.razor | 3 ++ .../Components/GridRowContent.razor.cs | 46 ++++++++++++++++++ .../Models/Alert/AlertOptions.cs | 21 ++++++++ 10 files changed, 202 insertions(+), 23 deletions(-) delete mode 100644 src/Connected.Components.Showcase.Runner/Program.cs create mode 100644 src/Connected.Components/Components/Grid.razor create mode 100644 src/Connected.Components/Components/Grid.razor.cs create mode 100644 src/Connected.Components/Components/GridRow.razor create mode 100644 src/Connected.Components/Components/GridRow.razor.cs create mode 100644 src/Connected.Components/Components/GridRowContent.razor create mode 100644 src/Connected.Components/Components/GridRowContent.razor.cs create mode 100644 src/connected.components/Models/Alert/AlertOptions.cs diff --git a/.gitignore b/.gitignore index 7ae34d7..d7f1dd6 100644 --- a/.gitignore +++ b/.gitignore @@ -431,3 +431,8 @@ FodyWeavers.xsd **.Runner/** **.DS_Store +/src/Connected.Components/Models/Alert/AlertOptions.cs +/src/Connected.Components/Components/DatePicker.razor.cs +/src/Connected.Components/Components/FormWizard.razor +/src/Connected.Components/Components/FormWizard.razor.cs +/src/Connected.Components.Showcase.Runner/Program.cs diff --git a/src/Connected.Components.Showcase.Runner/Pages/Democomp.razor b/src/Connected.Components.Showcase.Runner/Pages/Democomp.razor index 99153f9..691567e 100644 --- a/src/Connected.Components.Showcase.Runner/Pages/Democomp.razor +++ b/src/Connected.Components.Showcase.Runner/Pages/Democomp.razor @@ -906,12 +906,12 @@ - -