File tree 2 files changed +43
-0
lines changed
demos/demo-modules/selectable-month-day
2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,17 @@ export class DemoComponent {
22
22
23
23
events : CalendarEvent [ ] = [ ] ;
24
24
25
+ selectDay : ( day : CalendarMonthViewDay ) => void ;
26
+
27
+ constructor ( ) {
28
+ // an arrow function is used so that `this` is the component instance
29
+ this . selectDay = ( day : CalendarMonthViewDay ) : void => {
30
+ if ( this . selectedDay && day . date . getTime ( ) === this . selectedDay . date . getTime ( ) ) {
31
+ day . cssClass = 'cal-day-selected' ;
32
+ }
33
+ } ;
34
+ }
35
+
25
36
dayClicked ( day : CalendarMonthViewDay ) : void {
26
37
if ( this . selectedDay ) {
27
38
delete this . selectedDay . cssClass ;
Original file line number Diff line number Diff line change
1
+ < div class ="row ">
2
+ < div class ="col-md-6 ">
3
+ < div class ="btn-group ">
4
+ < div
5
+ class ="btn btn-primary "
6
+ mwlCalendarPreviousView
7
+ view ="month "
8
+ [(viewDate)] ="viewDate ">
9
+ Previous
10
+ </ div >
11
+ < div
12
+ class ="btn btn-secondary "
13
+ mwlCalendarToday
14
+ [(viewDate)] ="viewDate ">
15
+ Today
16
+ </ div >
17
+ < div
18
+ class ="btn btn-primary "
19
+ mwlCalendarNextView
20
+ view ="month "
21
+ [(viewDate)] ="viewDate ">
22
+ Next
23
+ </ div >
24
+ </ div >
25
+ </ div >
26
+ < div class ="col-md-6 text-right ">
27
+ < h3 > {{ viewDate | calendarDate:'monthViewTitle':'en' }}</ h3 >
28
+ </ div >
29
+ </ div >
30
+ < br >
31
+
1
32
< mwl-calendar-month-view
2
33
[viewDate] ="viewDate "
3
34
[events] ="events "
35
+ [dayModifier] ="selectDay "
4
36
(dayClicked) ="dayClicked($event.day) ">
5
37
</ mwl-calendar-month-view >
You can’t perform that action at this time.
0 commit comments