From 225f2bb34f6fe4294c9841cd505169cc6e9831af Mon Sep 17 00:00:00 2001 From: Alexander Kuzma Date: Fri, 5 May 2017 16:11:58 +0300 Subject: [PATCH] Was added new attribute 'anyDay'. --- src/css/angular-datepicker.css | 4 ++++ src/js/angular-datepicker.js | 26 ++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/css/angular-datepicker.css b/src/css/angular-datepicker.css index 4a26ee9..ddc8dac 100644 --- a/src/css/angular-datepicker.css +++ b/src/css/angular-datepicker.css @@ -207,3 +207,7 @@ datepicker, .datepicker, [datepicker], background: rgba(25,2,0,0.02); cursor: default; } + +._720kb-datepicker-calendar-day._720kb-datepicker-disabled._720kb-datepicker-disabled-active:hover { + cursor: pointer; +} \ No newline at end of file diff --git a/src/js/angular-datepicker.js b/src/js/angular-datepicker.js index 7d4261c..56a4bd4 100644 --- a/src/js/angular-datepicker.js +++ b/src/js/angular-datepicker.js @@ -107,13 +107,13 @@ return [ '
', - '', + '', '{{px}}', '', '', '{{item}}', '', - '', + '', '{{nx}}', '', '
' @@ -641,13 +641,30 @@ } }; - $scope.setDatepickerDay = function setDatepickerDay(day) { + $scope.setDatepickerDay = function setDatepickerDay(day, type) { + if (type && $scope.anyDay !== 'true') { + return; + } if ($scope.isSelectableDay($scope.monthNumber, $scope.year, day) && $scope.isSelectableDate($scope.monthNumber, $scope.year, day) && $scope.isSelectableMaxDate($scope.year + '/' + $scope.monthNumber + '/' + day) && $scope.isSelectableMinDate($scope.year + '/' + $scope.monthNumber + '/' + day)) { + if (type === 'previous') { + if ($scope.monthNumber !== 1) { + $scope.monthNumber--; + } else { + $scope.monthNumber = 12; + } + } else if (type === 'next') { + if ($scope.monthNumber !== 12) { + $scope.monthNumber++; + } else { + $scope.monthNumber = 1; + } + } + $scope.day = Number(day); $scope.selectedDay = $scope.day; $scope.selectedMonth = $scope.monthNumber; @@ -997,7 +1014,8 @@ 'datepickerAppendTo': '@', 'datepickerToggle': '@', 'datepickerClass': '@', - 'datepickerShow': '@' + 'datepickerShow': '@', + 'anyDay': '@' }, 'link': linkingFunction };