-
-
Notifications
You must be signed in to change notification settings - Fork 868
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dayView): allow the all day event template to be customised
- Loading branch information
Matt Lewis
committed
Apr 4, 2017
1 parent
149b605
commit d542d13
Showing
2 changed files
with
29 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,37 @@ | ||
import { Component, Input, Output, EventEmitter } from '@angular/core'; | ||
import { Component, Input, Output, EventEmitter, TemplateRef } from '@angular/core'; | ||
import { CalendarEvent } from 'calendar-utils'; | ||
|
||
@Component({ | ||
selector: 'mwl-calendar-all-day-event', | ||
template: ` | ||
<div | ||
class="cal-all-day-event" | ||
[style.backgroundColor]="event.color.secondary" | ||
[style.borderColor]="event.color.primary"> | ||
<mwl-calendar-event-title | ||
[event]="event" | ||
view="day" | ||
(click)="eventClicked.emit()"> | ||
</mwl-calendar-event-title> | ||
<mwl-calendar-event-actions [event]="event"></mwl-calendar-event-actions> | ||
</div> | ||
<ng-template #defaultTemplate> | ||
<div | ||
class="cal-all-day-event" | ||
[style.backgroundColor]="event.color.secondary" | ||
[style.borderColor]="event.color.primary"> | ||
<mwl-calendar-event-title | ||
[event]="event" | ||
view="day" | ||
(click)="eventClicked.emit()"> | ||
</mwl-calendar-event-title> | ||
<mwl-calendar-event-actions [event]="event"></mwl-calendar-event-actions> | ||
</div> | ||
</ng-template> | ||
<ng-template | ||
[ngTemplateOutlet]="customTemplate || defaultTemplate" | ||
[ngTemplateOutletContext]="{ | ||
event: event, | ||
eventClicked: eventClicked | ||
}"> | ||
</ng-template> | ||
` | ||
}) | ||
export class CalendarAllDayEventComponent { | ||
|
||
@Input() event: CalendarEvent; | ||
|
||
@Input() customTemplate: TemplateRef<any>; | ||
|
||
@Output() eventClicked: EventEmitter<any> = new EventEmitter(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters