@@ -14,7 +14,8 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
14
14
maxMode : 'year' ,
15
15
showWeeks : true ,
16
16
startingDay : 0 ,
17
- yearRange : 20 ,
17
+ yearRows : 4 ,
18
+ yearColumns : 5 ,
18
19
minDate : null ,
19
20
maxDate : null ,
20
21
shortcutPropagation : false
@@ -33,7 +34,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
33
34
} ) ;
34
35
35
36
// Evaled configuration attributes
36
- angular . forEach ( [ 'showWeeks' , 'startingDay' , 'yearRange ' , 'shortcutPropagation' ] , function ( key ) {
37
+ angular . forEach ( [ 'showWeeks' , 'startingDay' , 'yearRows' , 'yearColumns ', 'shortcutPropagation' ] , function ( key ) {
37
38
self [ key ] = angular . isDefined ( $attrs [ key ] ) ? $scope . $parent . $eval ( $attrs [ key ] ) : datepickerConfig [ key ] ;
38
39
} ) ;
39
40
@@ -396,15 +397,16 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
396
397
} ] )
397
398
398
399
. controller ( 'UibYearpickerController' , [ '$scope' , '$element' , 'dateFilter' , function ( scope , $element , dateFilter ) {
399
- var range ;
400
+ var columns , range ;
400
401
this . element = $element ;
401
402
402
403
function getStartingYear ( year ) {
403
404
return parseInt ( ( year - 1 ) / range , 10 ) * range + 1 ;
404
405
}
405
406
406
407
this . yearpickerInit = function ( ) {
407
- range = this . yearRange ;
408
+ columns = this . yearColumns ;
409
+ range = this . yearRows * columns ;
408
410
this . step = { years : range } ;
409
411
} ;
410
412
@@ -420,7 +422,8 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
420
422
}
421
423
422
424
scope . title = [ years [ 0 ] . label , years [ range - 1 ] . label ] . join ( ' - ' ) ;
423
- scope . rows = this . split ( years , 5 ) ;
425
+ scope . rows = this . split ( years , columns ) ;
426
+ scope . columns = columns ;
424
427
} ;
425
428
426
429
this . compare = function ( date1 , date2 ) {
@@ -433,13 +436,13 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
433
436
if ( key === 'left' ) {
434
437
date = date - 1 ;
435
438
} else if ( key === 'up' ) {
436
- date = date - 5 ;
439
+ date = date - columns ;
437
440
} else if ( key === 'right' ) {
438
441
date = date + 1 ;
439
442
} else if ( key === 'down' ) {
440
- date = date + 5 ;
443
+ date = date + columns ;
441
444
} else if ( key === 'pageup' || key === 'pagedown' ) {
442
- date += ( key === 'pageup' ? - 1 : 1 ) * this . step . years ;
445
+ date += ( key === 'pageup' ? - 1 : 1 ) * range ;
443
446
} else if ( key === 'home' ) {
444
447
date = getStartingYear ( this . activeDate . getFullYear ( ) ) ;
445
448
} else if ( key === 'end' ) {
@@ -651,7 +654,7 @@ function(scope, element, attrs, $compile, $parse, $document, $rootScope, $positi
651
654
datepickerEl . attr ( 'date-disabled' , 'dateDisabled({ date: date, mode: mode })' ) ;
652
655
}
653
656
654
- angular . forEach ( [ 'formatDay' , 'formatMonth' , 'formatYear' , 'formatDayHeader' , 'formatDayTitle' , 'formatMonthTitle' , 'showWeeks' , 'startingDay' , 'yearRange ' ] , function ( key ) {
657
+ angular . forEach ( [ 'formatDay' , 'formatMonth' , 'formatYear' , 'formatDayHeader' , 'formatDayTitle' , 'formatMonthTitle' , 'showWeeks' , 'startingDay' , 'yearRows' , 'yearColumns '] , function ( key ) {
655
658
if ( angular . isDefined ( attrs [ key ] ) ) {
656
659
datepickerEl . attr ( cameltoDash ( key ) , attrs [ key ] ) ;
657
660
}
0 commit comments