@@ -21,9 +21,24 @@ import { CalendarView, IgxMonthPickerBase } from './month-picker-base';
21
21
import { IgxMonthsViewComponent } from './months-view/months-view.component' ;
22
22
import { IgxYearsViewComponent } from './years-view/years-view.component' ;
23
23
import { IgxDaysViewComponent } from './days-view/days-view.component' ;
24
+ import { DateRangeDescriptor } from '../core/dates' ;
24
25
25
26
let NEXT_ID = 0 ;
26
27
28
+ export interface IDayView {
29
+ changeDaysView : boolean ;
30
+ animationAction : string ;
31
+ locale : string ;
32
+ value : Date | Date [ ] ;
33
+ viewDate : Date ;
34
+ weekStart : number ;
35
+ formatOptions : object ;
36
+ formatViews : object ;
37
+ selection : string ;
38
+ disabledDates : DateRangeDescriptor [ ] ;
39
+ specialDates : DateRangeDescriptor [ ] ;
40
+ }
41
+
27
42
/**
28
43
* **Ignite UI for Angular Calendar** -
29
44
* [Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/calendar.html)
@@ -90,6 +105,34 @@ export class IgxCalendarComponent extends IgxMonthPickerBase {
90
105
@Input ( )
91
106
public vertical = false ;
92
107
108
+ /**
109
+ * Sets/gets the number of dayViews duisplayed.
110
+ * Default value is `1`.
111
+ * ```html
112
+ * <igx-calendar [vertical] = "true" [daysViewNumber]="2"></igx-calendar>
113
+ * ```
114
+ * ```typescript
115
+ * let daysViewsDisplayed = this.calendar.daysViewNumber;
116
+ * ```
117
+ */
118
+ @Input ( )
119
+ get daysViewNumber ( ) {
120
+ return this . _daysViewNumber ;
121
+ }
122
+
123
+ set daysViewNumber ( val : number ) {
124
+ this . _daysViewNumber = val ;
125
+
126
+ for ( let i = 1 ; i < val ; i ++ ) {
127
+ const dayView = Object . assign ( { } , this . defaultDayView ) ;
128
+ dayView . value = null ;
129
+ const nextMonthDate = new Date ( dayView . viewDate ) ;
130
+ nextMonthDate . setMonth ( nextMonthDate . getMonth ( ) + i ) ;
131
+ dayView . viewDate = nextMonthDate ;
132
+ this . dayViews . push ( dayView ) ;
133
+ }
134
+ }
135
+
93
136
/**
94
137
* The default `tabindex` attribute for the component.
95
138
*
@@ -273,6 +316,33 @@ export class IgxCalendarComponent extends IgxMonthPickerBase {
273
316
*/
274
317
private _monthAction = '' ;
275
318
319
+ /**
320
+ *@hidden
321
+ */
322
+ private _daysViewNumber = 1 ;
323
+
324
+ /**
325
+ *@hidden
326
+ */
327
+ private defaultDayView : IDayView = {
328
+ changeDaysView : true ,
329
+ animationAction : this . _monthAction ,
330
+ locale : this . locale ,
331
+ value : this . value ,
332
+ viewDate : this . viewDate ,
333
+ weekStart : this . weekStart ,
334
+ formatOptions : this . formatOptions ,
335
+ formatViews : this . formatViews ,
336
+ selection : this . selection ,
337
+ disabledDates : this . disabledDates ,
338
+ specialDates : this . specialDates
339
+ } ;
340
+
341
+ /**
342
+ *@hidden
343
+ */
344
+ private dayViews : Array < IDayView > = [ this . defaultDayView ] ;
345
+
276
346
/**
277
347
* Returns the locale representation of the month in the month view if enabled,
278
348
* otherwise returns the default `Date.getMonth()` value.
@@ -291,6 +361,9 @@ export class IgxCalendarComponent extends IgxMonthPickerBase {
291
361
*/
292
362
public previousMonth ( isKeydownTrigger : boolean = false ) {
293
363
this . viewDate = this . calendarModel . timedelta ( this . viewDate , 'month' , - 1 ) ;
364
+ this . dayViews . forEach ( ( val , index ) => {
365
+ val . viewDate = this . calendarModel . timedelta ( val . viewDate , 'month' , - 1 ) ;
366
+ } ) ;
294
367
this . _monthAction = 'prev' ;
295
368
296
369
if ( this . daysView ) {
@@ -315,6 +388,9 @@ export class IgxCalendarComponent extends IgxMonthPickerBase {
315
388
*/
316
389
public nextMonth ( isKeydownTrigger : boolean = false ) {
317
390
this . viewDate = this . calendarModel . timedelta ( this . viewDate , 'month' , 1 ) ;
391
+ this . dayViews . forEach ( ( val , index ) => {
392
+ val . viewDate = this . calendarModel . timedelta ( val . viewDate , 'month' , 1 ) ;
393
+ } ) ;
318
394
this . _monthAction = 'next' ;
319
395
320
396
if ( this . daysView ) {
@@ -401,6 +477,9 @@ export class IgxCalendarComponent extends IgxMonthPickerBase {
401
477
*/
402
478
public changeMonth ( event : Date ) {
403
479
this . viewDate = new Date ( this . viewDate . getFullYear ( ) , event . getMonth ( ) ) ;
480
+ this . dayViews . forEach ( ( val , index ) => {
481
+ val . viewDate . setMonth ( event . getMonth ( ) + index ) ;
482
+ } ) ;
404
483
this . activeView = CalendarView . DEFAULT ;
405
484
406
485
requestAnimationFrame ( ( ) => {
0 commit comments