mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Remove custom keyboard mode in datepicker (#13644)
This commit is contained in:
parent
7b836f91b2
commit
d3a62e85a5
2 changed files with 4 additions and 27 deletions
|
@ -1,5 +1,5 @@
|
|||
<div ng-switch="datepickerMode" role="application" ng-keydown="keydown($event)">
|
||||
<div ng-switch="datepickerMode" role="application">
|
||||
<daypicker ng-switch-when="day" tabindex="0"></daypicker>
|
||||
<monthpicker ng-switch-when="month" tabindex="0"></monthpicker>
|
||||
<yearpicker ng-switch-when="year" tabindex="0"></yearpicker>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -119,6 +119,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
|
|||
} else {
|
||||
self.activeDate = date;
|
||||
$scope.datepickerMode = self.modes[ self.modes.indexOf( $scope.datepickerMode ) - 1 ];
|
||||
focusElement();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -137,6 +138,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
|
|||
}
|
||||
|
||||
$scope.datepickerMode = self.modes[ self.modes.indexOf( $scope.datepickerMode ) + direction ];
|
||||
focusElement();
|
||||
};
|
||||
|
||||
// Key event mapper
|
||||
|
@ -150,31 +152,6 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
|
|||
|
||||
// Listen for focus requests from popup directive
|
||||
$scope.$on('datepicker.focus', focusElement);
|
||||
|
||||
$scope.keydown = function( evt ) {
|
||||
var key = $scope.keys[evt.which];
|
||||
|
||||
if ( !key || evt.shiftKey || evt.altKey ) {
|
||||
return;
|
||||
}
|
||||
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
|
||||
if (key === 'enter' || key === 'space') {
|
||||
if ( self.isDisabled(self.activeDate)) {
|
||||
return; // do nothing
|
||||
}
|
||||
$scope.select(self.activeDate);
|
||||
focusElement();
|
||||
} else if (evt.ctrlKey && (key === 'up' || key === 'down')) {
|
||||
$scope.toggleMode(key === 'up' ? 1 : -1);
|
||||
focusElement();
|
||||
} else {
|
||||
self.handleKeyDown(key, evt);
|
||||
self.refreshView();
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
||||
.directive( 'datepicker', function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue