Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Commit e3201dd

Browse files
committed
to be tried
1 parent 5538bd5 commit e3201dd

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

src/css/angular-datepicker.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,3 @@ datepicker, .datepicker, [datepicker],
197197
background: rgba(25,2,0,0.02);
198198
cursor: default;
199199
}
200-
/*options*/
201-
[datepicker-toggle="false"] > ._720kb-datepicker-calendar{
202-
visibility:visible;
203-
}

src/js/angular-datepicker.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
, generateHtmlTemplate = function generateHtmlTemplate(prevButton, nextButton) {
118118

119119
var toReturn = [
120-
'<div class="_720kb-datepicker-calendar {{datepickerClass}} {{datepickerID}}" ng-class="{\'_720kb-datepicker-forced-to-open\': checkAndToggleVisibility()}" ng-blur="hideCalendar()">',
120+
'<div class="_720kb-datepicker-calendar {{datepickerClass}} {{datepickerID}}" ng-class="{\'_720kb-datepicker-forced-to-open\': checkVisibility()}" ng-blur="hideCalendar()">',
121121
'</div>'
122122
]
123123
, monthAndYearHeader = generateMonthAndYearHeader(prevButton, nextButton)
@@ -267,17 +267,13 @@
267267
classHelper.add(theCalendar, '_720kb-datepicker-open');
268268
}
269269
}
270-
, checkAndToggleVisibility = function checkAndToggleVisibility() {
270+
, checkToggle = function checkToggle() {
271271

272-
if ($scope.datepickerShow &&
273-
$scope.$eval($scope.datepickerShow)) {
274-
275-
showCalendar();
276-
} else if ($scope.datepickerShow &&
277-
!$scope.$eval($scope.datepickerShow)) {
272+
return $scope.$eval($scope.datepickerToggle);
273+
}
274+
, checkVisibility = function checkVisibility() {
278275

279-
$scope.hideCalendar();
280-
}
276+
return $scope.$eval($scope.datepickerShow);
281277
}
282278
, setDaysInMonth = function setDaysInMonth(month, year) {
283279

@@ -358,7 +354,6 @@
358354

359355
setInputValue();
360356
}
361-
checkAndToggleVisibility();
362357
}
363358
});
364359

@@ -735,9 +730,7 @@
735730
theCalendar = element[0].querySelector('._720kb-datepicker-calendar');
736731
}
737732
//if datepicker-toggle="" is not present or true by default
738-
if (!$scope.datepickerToggle ||
739-
$scope.datepickerToggle !== 'false' ||
740-
!$scope.$eval($scope.datepickerToggle)) {
733+
if (checkToggle()) {
741734

742735
thisInput.on('focus click focusin', function onFocusAndClick() {
743736

@@ -751,7 +744,6 @@
751744

752745
showCalendar();
753746
}
754-
checkAndToggleVisibility();
755747
});
756748
}
757749

@@ -794,8 +786,9 @@
794786

795787
//datepicker boot start
796788
$scope.paginateYears($scope.year);
789+
797790
setDaysInMonth($scope.monthNumber, $scope.year);
798-
$scope.checkAndToggleVisibility = checkAndToggleVisibility;
791+
$scope.checkVisibility = checkVisibility;
799792

800793
$scope.$on('$destroy', function unregisterListener() {
801794

0 commit comments

Comments
 (0)