@@ -16,10 +16,10 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
16
16
maxMode : 'year' ,
17
17
minDate : null ,
18
18
minMode : 'day' ,
19
+ monthColumns : 3 ,
19
20
ngModelOptions : { } ,
20
21
shortcutPropagation : false ,
21
22
showWeeks : true ,
22
- monthColumns : 3 ,
23
23
yearColumns : 5 ,
24
24
yearRows : 4
25
25
} )
@@ -53,10 +53,10 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
53
53
'maxMode' ,
54
54
'minDate' ,
55
55
'minMode' ,
56
+ 'monthColumns' ,
56
57
'showWeeks' ,
57
58
'shortcutPropagation' ,
58
59
'startingDay' ,
59
- 'monthColumns' ,
60
60
'yearColumns' ,
61
61
'yearRows'
62
62
] . forEach ( function ( key ) {
@@ -79,9 +79,9 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
79
79
$interpolate ( $scope . datepickerOptions [ key ] ) ( $scope . $parent ) :
80
80
datepickerConfig [ key ] ;
81
81
break ;
82
+ case 'monthColumns' :
82
83
case 'showWeeks' :
83
84
case 'shortcutPropagation' :
84
- case 'monthColumns' :
85
85
case 'yearColumns' :
86
86
case 'yearRows' :
87
87
self [ key ] = angular . isDefined ( $scope . datepickerOptions [ key ] ) ?
@@ -461,13 +461,11 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
461
461
} ] )
462
462
463
463
. controller ( 'UibMonthpickerController' , [ '$scope' , '$element' , 'dateFilter' , function ( scope , $element , dateFilter ) {
464
- var columns ;
465
464
this . step = { years : 1 } ;
466
465
this . element = $element ;
467
466
468
467
this . init = function ( ctrl ) {
469
468
angular . extend ( ctrl , this ) ;
470
- columns = ctrl . monthColumns ;
471
469
ctrl . refreshView ( ) ;
472
470
} ;
473
471
@@ -485,8 +483,8 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
485
483
}
486
484
487
485
scope . title = dateFilter ( this . activeDate , this . formatMonthTitle ) ;
488
- scope . rows = this . split ( months , columns ) ;
489
- scope . yearHeaderColspan = columns > 3 ? columns - 2 : 1 ;
486
+ scope . rows = this . split ( months , this . monthColumns ) ;
487
+ scope . yearHeaderColspan = this . monthColumns > 3 ? this . monthColumns - 2 : 1 ;
490
488
} ;
491
489
492
490
this . compare = function ( date1 , date2 ) {
@@ -503,11 +501,11 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
503
501
if ( key === 'left' ) {
504
502
date = date - 1 ;
505
503
} else if ( key === 'up' ) {
506
- date = date - columns ;
504
+ date = date - this . monthColumns ;
507
505
} else if ( key === 'right' ) {
508
506
date = date + 1 ;
509
507
} else if ( key === 'down' ) {
510
- date = date + columns ;
508
+ date = date + this . monthColumns ;
511
509
} else if ( key === 'pageup' || key === 'pagedown' ) {
512
510
var year = this . activeDate . getFullYear ( ) + ( key === 'pageup' ? - 1 : 1 ) ;
513
511
this . activeDate . setFullYear ( year ) ;
0 commit comments