Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
updated dist bump
Browse files Browse the repository at this point in the history
  • Loading branch information
Cresten St. Clair committed Feb 27, 2015
1 parent d93ac68 commit ba4782a
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions dist/bulbs-autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,32 @@ angular.module('BulbsAutocomplete.suggest.groupBy.directive', [])
link: function (scope) {
scope.$watch('items', function (newItemsValue) {
scope.groupedItems = _.chain(scope.grouper(newItemsValue)).mapValues(function (group) {
return group;
})
.pairs()
.value();
return group;
})
.pairs()
.value();
});
scope.selectedGroupIndex = -1;
scope.selectedIndex = -1;
scope.$on(BULBS_AUTOCOMPLETE_EVENT_KEYPRESS, function (event, keyEvent) {
if (!_.isEmpty(scope.groupedItems)) {
var lastIndexOfGroups = scope.groupedItems.length - 1;

if (lastIndexOfGroups < scope.selectedGroupIndex) {
scope.selectedGroupIndex = -1;
scope.selectedIndex = -1;
}

var items;
var lastIndexOfItems;
switch (keyEvent.keyCode) {
case 13:
// enter
if (scope.selectedGroupIndex !== -1 && scope.selectedIndex !== -1) {
items = scope.groupedItems[scope.selectedGroupIndex][1];
scope.onSelect({selection: items[scope.selectedIndex]});
scope.onSelect({
selection: items[scope.selectedIndex]
});
}
break;
case 38:
Expand Down

0 comments on commit ba4782a

Please sign in to comment.