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

Commit d4c2f2f

Browse files
author
Brian Feister
committedFeb 16, 2015
v.0.9.8. Fixes #256, #404, #5321, #3, #456, #657, #597, #534, (maybe others?)
1 parent 0a0bf62 commit d4c2f2f

File tree

6 files changed

+59
-47
lines changed

6 files changed

+59
-47
lines changed
 

‎bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ui-select",
3-
"version": "0.9.7",
3+
"version": "0.9.8",
44
"homepage": "https://github.com/angular-ui/ui-select",
55
"authors": [
66
"AngularUI"

‎dist/select.css

+4-14
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
/*!
22
* ui-select
33
* http://github.com/angular-ui/ui-select
4-
* Version: 0.9.7 - 2015-02-13T15:09:21.838Z
5-
* License: MIT
6-
*/
7-
8-
9-
/*!
10-
* ui-select
11-
* http://github.com/angular-ui/ui-select
12-
* Version: 0.9.5 - 2014-12-12T16:07:20.859Z
4+
* Version: 0.9.8 - 2015-02-16T15:10:00.891Z
135
* License: MIT
146
*/
157

@@ -90,6 +82,9 @@
9082

9183
.ui-select-bootstrap .ui-select-toggle {
9284
position: relative;
85+
86+
/* Instead of center because of .btn */
87+
text-align: left;
9388
}
9489

9590
.ui-select-bootstrap .ui-select-toggle > .caret {
@@ -112,11 +107,6 @@
112107
border-bottom-right-radius: 0;
113108
}
114109

115-
.ui-select-bootstrap > .ui-select-match {
116-
/* Instead of center because of .btn */
117-
text-align: left;
118-
}
119-
120110
.ui-select-bootstrap > .ui-select-match > .caret {
121111
position: absolute;
122112
top: 45%;

‎dist/select.js

+49-22
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.9.7 - 2015-02-13T15:09:21.834Z
4+
* Version: 0.9.8 - 2015-02-16T15:10:00.887Z
55
* License: MIT
66
*/
77

@@ -428,7 +428,7 @@
428428
}
429429
}
430430
// search ctrl.selected for dupes potentially caused by tagging and return early if found
431-
if ( ctrl.selected && ctrl.selected.filter( function (selection) { return angular.equals(selection, item); }).length > 0 ) {
431+
if ( ctrl.selected && angular.isArray(ctrl.selected) && ctrl.selected.filter( function (selection) { return angular.equals(selection, item); }).length > 0 ) {
432432
ctrl.close(skipFocusser);
433433
return;
434434
}
@@ -464,6 +464,7 @@
464464
// Closes the dropdown
465465
ctrl.close = function(skipFocusser) {
466466
if (!ctrl.open) return;
467+
if (ctrl.ngModel && ctrl.ngModel.$setTouched) ctrl.ngModel.$setTouched();
467468
_resetSearchInput();
468469
ctrl.open = false;
469470
if (!ctrl.multiple){
@@ -696,6 +697,24 @@
696697

697698
});
698699

700+
// If tagging try to split by tokens and add items
701+
_searchInput.on('paste', function (e) {
702+
var data = e.originalEvent.clipboardData.getData('text/plain');
703+
if (data && data.length > 0 && ctrl.taggingTokens.isActivated && ctrl.tagging.fct) {
704+
var items = data.split(ctrl.taggingTokens.tokens[0]); // split by first token only
705+
if (items && items.length > 0) {
706+
angular.forEach(items, function (item) {
707+
var newItem = ctrl.tagging.fct(item);
708+
if (newItem) {
709+
ctrl.select(newItem, true);
710+
}
711+
});
712+
e.preventDefault();
713+
e.stopPropagation();
714+
}
715+
}
716+
});
717+
699718
_searchInput.on('keyup', function(e) {
700719
if ( ! KEY.isVerticalMovement(e.which) ) {
701720
$scope.$evalAsync( function () {
@@ -826,24 +845,26 @@
826845
}
827846

828847
function _findApproxDupe(haystack, needle) {
829-
var tempArr = angular.copy(haystack);
830848
var dupeIndex = -1;
831-
for (var i = 0; i <tempArr.length; i++) {
832-
// handle the simple string version of tagging
833-
if ( ctrl.tagging.fct === undefined ) {
834-
// search the array for the match
835-
if ( tempArr[i]+' '+ctrl.taggingLabel === needle ) {
836-
dupeIndex = i;
837-
}
838-
// handle the object tagging implementation
839-
} else {
840-
var mockObj = tempArr[i];
841-
mockObj.isTag = true;
842-
if ( angular.equals(mockObj, needle) ) {
843-
dupeIndex = i;
844-
}
845-
}
846-
}
849+
if(angular.isArray(haystack)) {
850+
var tempArr = angular.copy(haystack);
851+
for (var i = 0; i <tempArr.length; i++) {
852+
// handle the simple string version of tagging
853+
if ( ctrl.tagging.fct === undefined ) {
854+
// search the array for the match
855+
if ( tempArr[i]+' '+ctrl.taggingLabel === needle ) {
856+
dupeIndex = i;
857+
}
858+
// handle the object tagging implementation
859+
} else {
860+
var mockObj = tempArr[i];
861+
mockObj.isTag = true;
862+
if ( angular.equals(mockObj, needle) ) {
863+
dupeIndex = i;
864+
}
865+
}
866+
}
867+
}
847868
return dupeIndex;
848869
}
849870

@@ -880,7 +901,7 @@
880901
}
881902

882903
$scope.$on('$destroy', function() {
883-
_searchInput.off('keyup keydown tagged blur');
904+
_searchInput.off('keyup keydown tagged blur paste');
884905
});
885906
}])
886907

@@ -960,7 +981,11 @@
960981
if ($select.multiple){
961982
var resultMultiple = [];
962983
var checkFnMultiple = function(list, value){
963-
if (!list || !list.length) return;
984+
//if the list is empty add the value to the list
985+
if (!list || !list.length){
986+
resultMultiple.unshift(value);
987+
return true;
988+
}
964989
for (var p = list.length - 1; p >= 0; p--) {
965990
locals[$select.parserResult.itemName] = list[p];
966991
result = $select.parserResult.modelMapper(scope, locals);
@@ -1205,13 +1230,15 @@
12051230

12061231
var transcludedMatch = transcluded.querySelectorAll('.ui-select-match');
12071232
transcludedMatch.removeAttr('ui-select-match'); //To avoid loop in case directive as attr
1233+
transcludedMatch.removeAttr('data-ui-select-match'); // Properly handle HTML5 data-attributes
12081234
if (transcludedMatch.length !== 1) {
12091235
throw uiSelectMinErr('transcluded', "Expected 1 .ui-select-match but got '{0}'.", transcludedMatch.length);
12101236
}
12111237
element.querySelectorAll('.ui-select-match').replaceWith(transcludedMatch);
12121238

12131239
var transcludedChoices = transcluded.querySelectorAll('.ui-select-choices');
12141240
transcludedChoices.removeAttr('ui-select-choices'); //To avoid loop in case directive as attr
1241+
transcludedChoices.removeAttr('data-ui-select-choices'); // Properly handle HTML5 data-attributes
12151242
if (transcludedChoices.length !== 1) {
12161243
throw uiSelectMinErr('transcluded', "Expected 1 .ui-select-choices but got '{0}'.", transcludedChoices.length);
12171244
}
@@ -1344,7 +1371,7 @@
13441371

13451372
angular.module("ui.select").run(["$templateCache", function($templateCache) {$templateCache.put("bootstrap/choices.tpl.html","<ul class=\"ui-select-choices ui-select-choices-content dropdown-menu\" role=\"listbox\" ng-show=\"$select.items.length > 0\"><li class=\"ui-select-choices-group\" id=\"ui-select-choices-{{ $select.generatedId }}\"><div class=\"divider\" ng-show=\"$select.isGrouped && $index > 0\"></div><div ng-show=\"$select.isGrouped\" class=\"ui-select-choices-group-label dropdown-header\" ng-bind=\"$group.name\"></div><div id=\"ui-select-choices-row-{{ $select.generatedId }}-{{$index}}\" class=\"ui-select-choices-row\" ng-class=\"{active: $select.isActive(this), disabled: $select.isDisabled(this)}\" role=\"option\"><a href=\"javascript:void(0)\" class=\"ui-select-choices-row-inner\"></a></div></li></ul>");
13461373
$templateCache.put("bootstrap/match-multiple.tpl.html","<span class=\"ui-select-match\"><span ng-repeat=\"$item in $select.selected\"><span style=\"margin-right: 3px;\" class=\"ui-select-match-item btn btn-default btn-xs\" tabindex=\"-1\" type=\"button\" ng-disabled=\"$select.disabled\" ng-click=\"$select.activeMatchIndex = $index;\" ng-class=\"{\'btn-primary\':$select.activeMatchIndex === $index, \'select-locked\':$select.isLocked(this, $index)}\"><span class=\"close ui-select-match-close\" ng-hide=\"$select.disabled\" ng-click=\"$select.removeChoice($index)\">&nbsp;&times;</span> <span uis-transclude-append=\"\"></span></span></span></span>");
1347-
$templateCache.put("bootstrap/match.tpl.html","<div class=\"ui-select-match\" ng-hide=\"$select.open\" ng-disabled=\"$select.disabled\" ng-class=\"{\'btn-default-focus\':$select.focus}\"><button aria-label=\"{{ $select.baseTitle }} activate\" type=\"button\" class=\"btn btn-default btn-block ui-select-toggle\" tabindex=\"-1\" ;=\"\" ng-disabled=\"$select.disabled\" ng-click=\"$select.activate()\"><span ng-show=\"$select.isEmpty()\" class=\"ui-select-placeholder text-muted\">{{$select.placeholder}}</span> <span ng-hide=\"$select.isEmpty()\" class=\"ui-select-match-text\" ng-class=\"{\'ui-select-allow-clear\': $select.allowClear && !$select.isEmpty()}\" ng-transclude=\"\"></span> <i class=\"caret pull-right\" ng-click=\"$select.toggle($event)\"></i></button><button aria-label=\"{{ $select.baseTitle }} clear\" type=\"button\" class=\"ui-select-clear\" ng-if=\"$select.allowClear && !$select.isEmpty()\" ng-click=\"$select.select(undefined)\"><i class=\"glyphicon glyphicon-remove\"></i></button></div>");
1374+
$templateCache.put("bootstrap/match.tpl.html","<div class=\"ui-select-match\" ng-hide=\"$select.open\" ng-disabled=\"$select.disabled\" ng-class=\"{\'btn-default-focus\':$select.focus}\"><button aria-label=\"{{ $select.baseTitle }} activate\" type=\"button\" class=\"btn btn-default form-control ui-select-toggle\" tabindex=\"-1\" ;=\"\" ng-disabled=\"$select.disabled\" ng-click=\"$select.activate()\"><span ng-show=\"$select.isEmpty()\" class=\"ui-select-placeholder text-muted\">{{$select.placeholder}}</span> <span ng-hide=\"$select.isEmpty()\" class=\"ui-select-match-text\" ng-class=\"{\'ui-select-allow-clear\': $select.allowClear && !$select.isEmpty()}\" ng-transclude=\"\"></span> <i class=\"caret pull-right\" ng-click=\"$select.toggle($event)\"></i></button><button aria-label=\"{{ $select.baseTitle }} clear\" type=\"button\" class=\"ui-select-clear\" ng-if=\"$select.allowClear && !$select.isEmpty()\" ng-click=\"$select.select(undefined)\"><i class=\"glyphicon glyphicon-remove\"></i></button></div>");
13481375
$templateCache.put("bootstrap/select-multiple.tpl.html","<div class=\"ui-select-container ui-select-multiple ui-select-bootstrap dropdown form-control\" ng-class=\"{open: $select.open}\"><div><div class=\"ui-select-match\"></div><input type=\"text\" autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\" class=\"ui-select-search input-xs\" placeholder=\"{{$select.getPlaceholder()}}\" ng-disabled=\"$select.disabled\" ng-hide=\"$select.disabled\" ng-click=\"$select.activate()\" ng-model=\"$select.search\" role=\"combobox\" aria-label=\"{{ $select.baseTitle }}\"></div><div class=\"ui-select-choices\"></div></div>");
13491376
$templateCache.put("bootstrap/select.tpl.html","<div class=\"ui-select-container ui-select-bootstrap dropdown\" ng-class=\"{open: $select.open}\"><div class=\"ui-select-match\"></div><input type=\"text\" autocomplete=\"off\" tabindex=\"-1\" aria-expanded=\"true\" aria-label=\"{{ $select.baseTitle }}\" aria-owns=\"ui-select-choices-{{ $select.generatedId }}\" aria-activedescendant=\"ui-select-choices-row-{{ $select.generatedId }}-{{ $select.activeIndex }}\" class=\"form-control ui-select-search\" placeholder=\"{{$select.placeholder}}\" ng-model=\"$select.search\" ng-show=\"$select.searchEnabled && $select.open\"><div class=\"ui-select-choices\"></div></div>");
13501377
$templateCache.put("select2/choices.tpl.html","<ul class=\"ui-select-choices ui-select-choices-content select2-results\"><li class=\"ui-select-choices-group\" ng-class=\"{\'select2-result-with-children\': $select.choiceGrouped($group) }\"><div ng-show=\"$select.choiceGrouped($group)\" class=\"ui-select-choices-group-label select2-result-label\" ng-bind=\"$group.name\"></div><ul role=\"listbox\" id=\"ui-select-choices-{{ $select.generatedId }}\" ng-class=\"{\'select2-result-sub\': $select.choiceGrouped($group), \'select2-result-single\': !$select.choiceGrouped($group) }\"><li role=\"option\" id=\"ui-select-choices-row-{{ $select.generatedId }}-{{$index}}\" class=\"ui-select-choices-row\" ng-class=\"{\'select2-highlighted\': $select.isActive(this), \'select2-disabled\': $select.isDisabled(this)}\"><div class=\"select2-result-label ui-select-choices-row-inner\"></div></li></ul></li></ul>");

‎dist/select.min.css

+2-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/select.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"repository": {
77
"url": "git://github.com/angular-ui/ui-select.git"
88
},
9-
"version": "0.9.7",
9+
"version": "0.9.8",
1010
"devDependencies": {
1111
"bower": "~1.3",
1212
"del": "~0.1.1",

0 commit comments

Comments
 (0)
This repository has been archived.