Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 6793747

Browse files
author
Brian Feister
committed
Finalizes over-selection problem for taggingLabel === false being having ambiguous ctrl.activeIndex
1 parent e6a04b4 commit 6793747

File tree

6 files changed

+23
-6
lines changed

6 files changed

+23
-6
lines changed

dist/select.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* ui-select
33
* http://github.com/angular-ui/ui-select
4-
* Version: 0.8.3 - 2014-10-21T21:55:48.791Z
4+
* Version: 0.8.3 - 2014-10-21T22:40:46.669Z
55
* License: MIT
66
*/
77

dist/select.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* ui-select
33
* http://github.com/angular-ui/ui-select
4-
* Version: 0.8.3 - 2014-10-21T21:55:48.787Z
4+
* Version: 0.8.3 - 2014-10-21T22:40:46.668Z
55
* License: MIT
66
*/
77

@@ -320,6 +320,9 @@
320320

321321
ctrl.isActive = function(itemScope) {
322322
var itemIndex = ctrl.items.indexOf(itemScope[ctrl.itemProperty]);
323+
if ( ctrl.taggingLabel === false && ctrl.activeIndex === -1 ) {
324+
return false;
325+
}
323326
return ctrl.open && itemIndex === ctrl.activeIndex;
324327
};
325328

@@ -601,6 +604,11 @@
601604
});
602605

603606
_searchInput.on('keyup', function(e) {
607+
if ( ! KEY.isVerticalMovement(e.which) ) {
608+
$scope.$evalAsync( function () {
609+
ctrl.activeIndex = ctrl.taggingLabel === false ? -1 : 0;
610+
});
611+
}
604612
// Push a "create new" item into array if there is a search string
605613
if ( ctrl.tagging.isActivated && ctrl.search.length > 0 ) {
606614

dist/select.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/select.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/demo-tagging.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ <h3>Simple String Tags</h3>
7474
<p>Selected: {{multipleDemo.colors}}</p>
7575
<hr>
7676

77-
<h3>Simple String Tags (No Labels)</h3>
77+
<h3>Simple String Tags </h3>
78+
<h4>(Predictive Search Model / No Labels)</h4>
7879
<ui-select multiple tagging tagging-label="false" ng-model="multipleDemo.colors2" theme="bootstrap" ng-disabled="disabled" style="width: 300px;">
7980
<ui-select-match placeholder="Select colors...">{{$item}}</ui-select-match>
8081
<ui-select-choices repeat="color in availableColors | filter:$select.search">

src/select.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@
312312

313313
ctrl.isActive = function(itemScope) {
314314
var itemIndex = ctrl.items.indexOf(itemScope[ctrl.itemProperty]);
315+
if ( ctrl.taggingLabel === false && ctrl.activeIndex === -1 ) {
316+
return false;
317+
}
315318
return ctrl.open && itemIndex === ctrl.activeIndex;
316319
};
317320

@@ -593,6 +596,11 @@
593596
});
594597

595598
_searchInput.on('keyup', function(e) {
599+
if ( ! KEY.isVerticalMovement(e.which) ) {
600+
$scope.$evalAsync( function () {
601+
ctrl.activeIndex = ctrl.taggingLabel === false ? -1 : 0;
602+
});
603+
}
596604
// Push a "create new" item into array if there is a search string
597605
if ( ctrl.tagging.isActivated && ctrl.search.length > 0 ) {
598606

0 commit comments

Comments
 (0)