|
615 | 615 | if ( ctrl.taggingTokens.tokens[i] === KEY.MAP[e.keyCode] ) {
|
616 | 616 | // make sure there is a new value to push via tagging
|
617 | 617 | if ( ctrl.search.length > 0 ) {
|
618 |
| - ctrl.select(null, true); |
| 618 | + ctrl.select(undefined, true); |
619 | 619 | _searchInput.triggerHandler('tagged');
|
620 | 620 | }
|
621 | 621 | }
|
|
704 | 704 | }
|
705 | 705 | // verify the the tag doesn't match the value of an existing item from
|
706 | 706 | // the searched data set
|
707 |
| - if ( stashArr.filter( function (origItem) { return origItem.toUpperCase() === ctrl.search.toUpperCase(); }).length > 0 ) { |
| 707 | + if ( _findCaseInsensitiveDupe(stashArr) ) { |
708 | 708 | // if there is a tag from prev iteration, strip it / queue the change
|
709 | 709 | // and return early
|
710 | 710 | if ( hasTag ) {
|
|
716 | 716 | }
|
717 | 717 | return;
|
718 | 718 | }
|
719 |
| - if ( ctrl.selected.filter( function (selection) { return selection.toUpperCase() === ctrl.search.toUpperCase(); } ).length > 0 ) { |
| 719 | + if ( _findCaseInsensitiveDupe(stashArr) ) { |
720 | 720 | // if there is a tag from prev iteration, strip it
|
721 | 721 | if ( hasTag ) {
|
722 | 722 | ctrl.items = stashArr.slice(1,stashArr.length);
|
|
752 | 752 | });
|
753 | 753 | });
|
754 | 754 |
|
| 755 | + function _findCaseInsensitiveDupe(arr) { |
| 756 | + if ( arr === undefined || ctrl.search === undefined ) { |
| 757 | + return false; |
| 758 | + } |
| 759 | + var hasDupe = arr.filter( function (origItem) { |
| 760 | + if ( ctrl.search.toUpperCase() === undefined ) { |
| 761 | + return false; |
| 762 | + } |
| 763 | + return origItem.toUpperCase() === ctrl.search.toUpperCase(); |
| 764 | + }).length > 0; |
| 765 | + |
| 766 | + return hasDupe; |
| 767 | + } |
| 768 | + |
755 | 769 | function _findApproxDupe(haystack, needle) {
|
756 | 770 | var tempArr = angular.copy(haystack);
|
757 | 771 | var dupeIndex = -1;
|
|
1220 | 1234 | attrs.$observe('placeholder', function(placeholder) {
|
1221 | 1235 | $select.placeholder = placeholder !== undefined ? placeholder : uiSelectConfig.placeholder;
|
1222 | 1236 | });
|
1223 |
| - |
| 1237 | + |
1224 | 1238 | $select.allowClear = (angular.isDefined(attrs.allowClear)) ? (attrs.allowClear === '') ? true : (attrs.allowClear.toLowerCase() === 'true') : false;
|
1225 | 1239 |
|
1226 | 1240 | if($select.multiple){
|
|
0 commit comments