@@ -60,7 +60,7 @@ import { CalendarEventTimesChangedEvent } from '../../interfaces/calendarEventTi
60
60
<div *ngFor="let rowIndex of view.rowOffsets">
61
61
<div class="cal-cell-row">
62
62
<mwl-calendar-month-cell
63
- *ngFor="let day of view.days | slice : rowIndex : rowIndex + 7 "
63
+ *ngFor="let day of view.days | slice : rowIndex : rowIndex + (view.totalDaysVisibleInWeek) "
64
64
[class.cal-drag-over]="day.dragOver"
65
65
[day]="day"
66
66
[openDay]="openDay"
@@ -98,6 +98,11 @@ export class CalendarMonthViewComponent implements OnChanges, OnInit, OnDestroy
98
98
*/
99
99
@Input ( ) events : CalendarEvent [ ] = [ ] ;
100
100
101
+ /**
102
+ * An array of day indexes (0 = sunday, 1 = monday etc) that will be hidden on the view
103
+ */
104
+ @Input ( ) excludeDays : number [ ] = [ ] ;
105
+
101
106
/**
102
107
* Whether the events list for the day of the `viewDate` option is visible or not
103
108
*/
@@ -193,18 +198,17 @@ export class CalendarMonthViewComponent implements OnChanges, OnInit, OnDestroy
193
198
*/
194
199
ngOnChanges ( changes : any ) : void {
195
200
196
- if ( changes . viewDate ) {
201
+ if ( changes . viewDate || changes . excludeDays ) {
197
202
this . refreshHeader ( ) ;
198
203
}
199
204
200
- if ( changes . viewDate || changes . events ) {
205
+ if ( changes . viewDate || changes . events || changes . excludeDays ) {
201
206
this . refreshBody ( ) ;
202
207
}
203
208
204
- if ( changes . activeDayIsOpen || changes . viewDate || changes . events ) {
209
+ if ( changes . activeDayIsOpen || changes . viewDate || changes . events || changes . excludeDays ) {
205
210
this . checkActiveDayIsOpen ( ) ;
206
211
}
207
-
208
212
}
209
213
210
214
/**
@@ -248,15 +252,17 @@ export class CalendarMonthViewComponent implements OnChanges, OnInit, OnDestroy
248
252
private refreshHeader ( ) : void {
249
253
this . columnHeaders = getWeekViewHeader ( {
250
254
viewDate : this . viewDate ,
251
- weekStartsOn : this . weekStartsOn
255
+ weekStartsOn : this . weekStartsOn ,
256
+ excluded : this . excludeDays
252
257
} ) ;
253
258
}
254
259
255
260
private refreshBody ( ) : void {
256
261
this . view = getMonthView ( {
257
262
events : this . events ,
258
263
viewDate : this . viewDate ,
259
- weekStartsOn : this . weekStartsOn
264
+ weekStartsOn : this . weekStartsOn ,
265
+ excluded : this . excludeDays
260
266
} ) ;
261
267
if ( this . dayModifier ) {
262
268
this . view . days . forEach ( day => this . dayModifier ( day ) ) ;
@@ -267,7 +273,7 @@ export class CalendarMonthViewComponent implements OnChanges, OnInit, OnDestroy
267
273
if ( this . activeDayIsOpen === true ) {
268
274
this . openDay = this . view . days . find ( day => isSameDay ( day . date , this . viewDate ) ) ;
269
275
const index : number = this . view . days . indexOf ( this . openDay ) ;
270
- this . openRowIndex = Math . floor ( index / 7 ) * 7 ;
276
+ this . openRowIndex = Math . floor ( index / this . view . totalDaysVisibleInWeek ) * this . view . totalDaysVisibleInWeek ;
271
277
} else {
272
278
this . openRowIndex = null ;
273
279
this . openDay = null ;
0 commit comments