Skip to content

Commit 712ded8

Browse files
author
Matt Lewis
committed
fix(weekView): custom event cssClass's are now added to the event container instead of the event i
BREAKING CHANGE: you may need to adjust your CSS slightly to account for this change. See the day view breaking change for how to migrate.
1 parent 591dd4a commit 712ded8

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

scss/week-view.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@
5050
cursor: move;
5151
}
5252

53-
.cal-event.cal-starts-within-week {
53+
.cal-starts-within-week .cal-event {
5454
border-top-left-radius: 5px;
5555
border-bottom-left-radius: 5px;
5656
}
5757

58-
.cal-event.cal-ends-within-week {
58+
.cal-ends-within-week .cal-event {
5959
border-top-right-radius: 5px;
6060
border-bottom-right-radius: 5px;
6161
}

src/components/week/calendarWeekView.component.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,13 @@ export interface WeekViewEventResize {
5555
</mwl-calendar-week-view-header>
5656
<div *ngFor="let eventRow of eventRows" #eventRowContainer class="cal-events-row">
5757
<div
58-
class="cal-event-container"
58+
*ngFor="let weekEvent of eventRow.row"
5959
#event
60+
class="cal-event-container"
6061
[class.cal-draggable]="weekEvent.event.draggable"
61-
*ngFor="let weekEvent of eventRow.row"
62+
[class.cal-starts-within-week]="!weekEvent.startsBeforeWeek"
63+
[class.cal-ends-within-week]="!weekEvent.endsAfterWeek"
64+
[ngClass]="weekEvent.event?.cssClass"
6265
[style.width]="((100 / days.length) * weekEvent.span) + '%'"
6366
[style.marginLeft]="((100 / days.length) * weekEvent.offset) + '%'"
6467
mwlResizable

src/components/week/calendarWeekViewEvent.component.ts

-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ import { WeekViewEvent } from 'calendar-utils';
1313
<ng-template #defaultTemplate>
1414
<div
1515
class="cal-event"
16-
[class.cal-starts-within-week]="!weekEvent.startsBeforeWeek"
17-
[class.cal-ends-within-week]="!weekEvent.endsAfterWeek"
1816
[style.backgroundColor]="weekEvent.event.color.secondary"
19-
[ngClass]="weekEvent.event?.cssClass"
2017
[mwlCalendarTooltip]="weekEvent.event.title | calendarEventTitle:'weekTooltip':weekEvent.event"
2118
[tooltipPlacement]="tooltipPlacement"
2219
[tooltipEvent]="weekEvent.event"

test/calendarWeekView.component.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe('calendarWeekView component', () => {
127127
fixture.detectChanges();
128128
expect(
129129
fixture.nativeElement
130-
.querySelector('.cal-event-container .cal-event')
130+
.querySelector('.cal-event-container')
131131
.classList.contains('foo')
132132
).to.equal(true);
133133
fixture.destroy();

0 commit comments

Comments
 (0)