diff --git a/BlazorScheduler/Components/Appointment.cs b/BlazorScheduler/Components/Appointment.cs index 23b77de..3ecf9e8 100644 --- a/BlazorScheduler/Components/Appointment.cs +++ b/BlazorScheduler/Components/Appointment.cs @@ -17,6 +17,8 @@ public partial class Appointment : ComponentBase, IDisposable [Parameter] public DateTime Start { get; set; } [Parameter] public DateTime End { get; set; } [Parameter] public string? Color { get; set; } + [Parameter] public string? Class { get; set; } + [Parameter] public string? Style { get; set; } private bool _isVisible = true; public bool IsVisible diff --git a/BlazorScheduler/Components/Scheduler.razor b/BlazorScheduler/Components/Scheduler.razor index 8976f3d..60275b4 100644 --- a/BlazorScheduler/Components/Scheduler.razor +++ b/BlazorScheduler/Components/Scheduler.razor @@ -76,7 +76,7 @@ @foreach (var week in GetDaysInRange().Chunk(7)) { var (start, end) = (week.First(), week.Last()); - + } diff --git a/BlazorScheduler/Components/Scheduler.razor.cs b/BlazorScheduler/Components/Scheduler.razor.cs index 40b910d..4f6a2a5 100644 --- a/BlazorScheduler/Components/Scheduler.razor.cs +++ b/BlazorScheduler/Components/Scheduler.razor.cs @@ -15,7 +15,10 @@ public partial class Scheduler : IAsyncDisposable [Parameter] public RenderFragment Appointments { get; set; } = null!; [Parameter] public RenderFragment? HeaderTemplate { get; set; } [Parameter] public RenderFragment? DayTemplate { get; set; } - + [Parameter] public string? RootDaysGroupInWeekStyle { get; set; } + [Parameter] public string? RootAppointmentOverflowStyle { get; set; } + [Parameter] public string? RootDayClass { get; set; } + [Parameter] public string? RootDayStyle { get; set; } [Parameter] public Func? OnRequestNewData { get; set; } [Parameter] public Func? OnAddingNewAppointment { get; set; } [Parameter] public Func? OnOverflowAppointmentClick { get; set; } diff --git a/BlazorScheduler/Internal/Components/SchedulerAllDayAppointment.razor b/BlazorScheduler/Internal/Components/SchedulerAllDayAppointment.razor index 1b1c934..d69f2cc 100644 --- a/BlazorScheduler/Internal/Components/SchedulerAllDayAppointment.razor +++ b/BlazorScheduler/Internal/Components/SchedulerAllDayAppointment.razor @@ -1,7 +1,7 @@ @namespace BlazorScheduler.Internal.Components -
@Appointment.RenderChildContent()
\ No newline at end of file diff --git a/BlazorScheduler/Internal/Components/SchedulerAppointment.razor b/BlazorScheduler/Internal/Components/SchedulerAppointment.razor index fa0d61f..526a3e4 100644 --- a/BlazorScheduler/Internal/Components/SchedulerAppointment.razor +++ b/BlazorScheduler/Internal/Components/SchedulerAppointment.razor @@ -1,6 +1,6 @@ @namespace BlazorScheduler.Internal.Components -
+
@Appointment.RenderChildContent()
\ No newline at end of file diff --git a/BlazorScheduler/Internal/Components/SchedulerAppointmentOverflow.razor b/BlazorScheduler/Internal/Components/SchedulerAppointmentOverflow.razor index c7e8fc8..0e8a196 100644 --- a/BlazorScheduler/Internal/Components/SchedulerAppointmentOverflow.razor +++ b/BlazorScheduler/Internal/Components/SchedulerAppointmentOverflow.razor @@ -1,5 +1,5 @@ @namespace BlazorScheduler.Internal.Components -
+
@Scheduler.PlusOthersText.Replace("{n}", AppointmentCount.ToString())
\ No newline at end of file diff --git a/BlazorScheduler/Internal/Components/SchedulerAppointmentOverflow.razor.cs b/BlazorScheduler/Internal/Components/SchedulerAppointmentOverflow.razor.cs index ac5bbe0..40eaec0 100644 --- a/BlazorScheduler/Internal/Components/SchedulerAppointmentOverflow.razor.cs +++ b/BlazorScheduler/Internal/Components/SchedulerAppointmentOverflow.razor.cs @@ -11,5 +11,6 @@ public partial class SchedulerAppointmentOverflow [Parameter] public int AppointmentCount { get; set;} [Parameter] public int Start { get; set; } [Parameter] public int Order { get; set; } + [Parameter] public string? Style { get; set; } } } diff --git a/BlazorScheduler/Internal/Components/SchedulerDay.razor b/BlazorScheduler/Internal/Components/SchedulerDay.razor index 29ebd1f..c86c36d 100644 --- a/BlazorScheduler/Internal/Components/SchedulerDay.razor +++ b/BlazorScheduler/Internal/Components/SchedulerDay.razor @@ -1,6 +1,6 @@ @namespace BlazorScheduler.Internal.Components -
+
@if (Scheduler.DayTemplate != null) { @Scheduler.DayTemplate(Day) diff --git a/BlazorScheduler/Internal/Components/SchedulerWeek.razor b/BlazorScheduler/Internal/Components/SchedulerWeek.razor index 14c1b13..ce7d3d5 100644 --- a/BlazorScheduler/Internal/Components/SchedulerWeek.razor +++ b/BlazorScheduler/Internal/Components/SchedulerWeek.razor @@ -1,10 +1,10 @@ @namespace BlazorScheduler.Internal.Components
-
+
@for (var dt = Start; dt <= End; dt = dt.AddDays(1)) { - + }
@@ -39,7 +39,7 @@ AppointmentCount="numOverFlowAppointments" Start="(dt.DayOfWeek - Scheduler.StartDayOfWeek + 7) % 7" Order="MaxNumOfAppointmentsPerDay" - @key="dt" /> + @key="dt" Style="@Scheduler.RootAppointmentOverflowStyle" /> } }
diff --git a/BlazorScheduler/wwwroot/css/styles.css b/BlazorScheduler/wwwroot/css/styles.css index 1ecc26d..bc42219 100644 --- a/BlazorScheduler/wwwroot/css/styles.css +++ b/BlazorScheduler/wwwroot/css/styles.css @@ -65,7 +65,7 @@ .scheduler > .month > .week > .days { display: flex; justify-content: space-around; - height: max(8.313rem, calc(1.5rem + 5px + 8px + var(--maxAppointments) * 1.2rem)); + height: max(8.313rem, calc(1.5rem + 5px + 8px + var(--maxAppointments) * 1.5rem)); } .scheduler > .month > .week.header { @@ -120,12 +120,12 @@ .scheduler > .month > .week > .appointments > .appointment { position: absolute; left: calc(var(--start) / 7 * 100%); - top: max(10px, calc(15px + (var(--order) * 1.2rem))); + top: max(10px, calc(15px + (var(--order) * 1.5rem))); border-radius: 2px; margin-left: 2px; width: calc((var(--end) - var(--start) + 1) / 7 * 100% - 4px); padding-left: 4px; - font-size: .75rem; + font-size: .95rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; diff --git a/DemoApp/AppointmentService.cs b/DemoApp/AppointmentService.cs index 740b33e..f5d179b 100644 --- a/DemoApp/AppointmentService.cs +++ b/DemoApp/AppointmentService.cs @@ -15,7 +15,7 @@ public IEnumerable GetAppointments(DateTime start, DateTime end) private readonly List AllAppointments = new() { - new AppointmentDto { Title = "Hello 1", Start = DateTime.Now, End = DateTime.Now.AddHours(1), Color = "yellow" }, + new AppointmentDto { Title = "Hello 1", Start = DateTime.Now, End = DateTime.Now.AddHours(1), Color = "yellow", Class = "bg-dark text-white"}, new AppointmentDto { Title = "Hello 2", Start = DateTime.Now.AddDays(3), End = DateTime.Now.AddDays(3).AddHours(1), Color = "red" }, new AppointmentDto { Title = "Hello 3", Start = DateTime.Today, End = DateTime.Today.AddDays(1), Color = "yellow" }, diff --git a/DemoApp/Models/AppointmentDto.cs b/DemoApp/Models/AppointmentDto.cs index 6e3e9af..a1e6344 100644 --- a/DemoApp/Models/AppointmentDto.cs +++ b/DemoApp/Models/AppointmentDto.cs @@ -8,5 +8,6 @@ public class AppointmentDto public DateTime Start { get; set; } public DateTime End { get; set; } public string Color { get; set; } + public string? Class { get; set; } } } diff --git a/DemoApp/Pages/Basic.razor b/DemoApp/Pages/Basic.razor index 63ca9a4..0d7c42f 100644 --- a/DemoApp/Pages/Basic.razor +++ b/DemoApp/Pages/Basic.razor @@ -5,7 +5,7 @@ @foreach (var app in _appointments) { - + @app.Title @if (context.IsTimed) { diff --git a/DemoApp/Pages/Configuration.razor b/DemoApp/Pages/Configuration.razor index b084588..a619bd3 100644 --- a/DemoApp/Pages/Configuration.razor +++ b/DemoApp/Pages/Configuration.razor @@ -43,6 +43,24 @@ + + + + + + + + + + + + + + + + + + Add appointments Clear appointments @@ -63,11 +81,14 @@ TodayButtonText="@_todayButtonText" PlusOthersText="@_plusOthersText" NewAppointmentText="@_newAppointmentText" - EnableAppointmentsCreationFromScheduler="@_enableAppCreationFromScheduler"> + EnableAppointmentsCreationFromScheduler="@_enableAppCreationFromScheduler" + RootDaysGroupInWeekStyle="@_rootDaysGroupInWeekStyles" + RootAppointmentOverflowStyle="@_rootAppointmentOverflowStyle" + RootDayClass="@_rootDayClass" RootDayStyle="@_rootDayStyle"> @foreach (var app in _appointments) { - + @app.Title } @@ -89,7 +110,14 @@ private string _todayButtonText = "Today"; private string _plusOthersText = "+ {n} others"; private string _newAppointmentText = "New Appointment"; - + + private string _classes = ""; + private string _styles = ""; + private string _rootDaysGroupInWeekStyles = ""; + private string _rootAppointmentOverflowStyle = ""; + private string _rootDayClass = ""; + private string _rootDayStyle = ""; + Task OnAddingNewAppointment(DateTime start, DateTime end) { _appointments.Add(new AppointmentDto { Start = start, End = end, Title = "A newly added appointment!", Color = "aqua" });