|
1 | 1 | /*!
|
2 | 2 | * ui-select
|
3 | 3 | * http://github.com/angular-ui/ui-select
|
4 |
| - * Version: 0.7.0 - 2014-10-06T12:31:14.673Z |
| 4 | + * Version: 0.8.0 - 2014-10-07T13:28:21.745Z |
5 | 5 | * License: MIT
|
6 | 6 | */
|
7 | 7 |
|
|
269 | 269 | if (ctrl.multiple){
|
270 | 270 | //Remove already selected items
|
271 | 271 | $scope.$watchCollection('$select.selected', function(selectedItems){
|
272 |
| - if (!selectedItems) return; |
| 272 | + if (!selectedItems.length) return; |
273 | 273 | var data = ctrl.parserResult.source($scope);
|
274 | 274 | if (!data) return;
|
275 | 275 | var filteredItems = data.filter(function(i) {return selectedItems.indexOf(i) < 0;});
|
276 | 276 | setItemsFn(filteredItems);
|
| 277 | + ctrl.sizeSearchInput(); |
277 | 278 | });
|
278 | 279 | }
|
279 | 280 |
|
|
592 | 593 | result;
|
593 | 594 | if ($select.multiple){
|
594 | 595 | var resultMultiple = [];
|
595 |
| - if (inputValue) { |
596 |
| - for (var j = inputValue.length - 1; j >= 0; j--) { |
597 |
| - locals = {}; |
598 |
| - locals[$select.parserResult.itemName] = inputValue[j]; |
599 |
| - result = $select.parserResult.modelMapper(scope, locals); |
600 |
| - resultMultiple.unshift(result); |
601 |
| - } |
| 596 | + for (var j = $select.selected.length - 1; j >= 0; j--) { |
| 597 | + locals = {}; |
| 598 | + locals[$select.parserResult.itemName] = $select.selected[j]; |
| 599 | + result = $select.parserResult.modelMapper(scope, locals); |
| 600 | + resultMultiple.unshift(result); |
602 | 601 | }
|
603 | 602 | return resultMultiple;
|
604 | 603 | }else{
|
|
758 | 757 | });
|
759 | 758 |
|
760 | 759 | if ($select.multiple){
|
761 |
| - scope.$watchCollection('$select.selected', function(newValue) { |
762 |
| - //On v1.2.19 the 2nd and 3rd parameteres are ignored |
763 |
| - //On v1.3.0-beta+ 3rd parameter (revalidate) is true, to force $parsers to recreate model |
764 |
| - ngModel.$setViewValue(newValue, null, true); |
| 760 | + scope.$watchCollection('$select.selected', function() { |
| 761 | + ngModel.$setViewValue(Date.now()); //Set timestamp as a unique string to force changes |
765 | 762 | });
|
766 | 763 | focusser.prop('disabled', true); //Focusser isn't needed if multiple
|
767 | 764 | }else{
|
|
955 | 952 | }());
|
956 | 953 |
|
957 | 954 | 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=\"menu\" aria-labelledby=\"dLabel\" ng-show=\"$select.items.length > 0\"><li class=\"ui-select-choices-group\"><div class=\"divider\" ng-show=\"$select.isGrouped && $index > 0\"></div><div ng-show=\"$select.isGrouped\" class=\"ui-select-choices-group-label dropdown-header\">{{$group.name}}</div><div class=\"ui-select-choices-row\" ng-class=\"{active: $select.isActive(this), disabled: $select.isDisabled(this)}\"><a href=\"javascript:void(0)\" class=\"ui-select-choices-row-inner\"></a></div></li></ul>");
|
958 |
| -$templateCache.put("bootstrap/match-multiple.tpl.html","<span class=\"ui-select-match\"><span ng-repeat=\"$item in $select.selected\"><button 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}\"><span class=\"close ui-select-match-close\" ng-hide=\"$select.disabled\" ng-click=\"$select.removeChoice($index)\"> ×</span> <span uis-transclude-append=\"\"></span></button></span></span>"); |
| 955 | +$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}\"><span class=\"close ui-select-match-close\" ng-hide=\"$select.disabled\" ng-click=\"$select.removeChoice($index)\"> ×</span> <span uis-transclude-append=\"\"></span></span></span></span>"); |
959 | 956 | $templateCache.put("bootstrap/match.tpl.html","<button type=\"button\" class=\"btn btn-default form-control ui-select-match\" tabindex=\"-1\" ng-hide=\"$select.open\" ng-disabled=\"$select.disabled\" ng-class=\"{\'btn-default-focus\':$select.focus}\" ;=\"\" ng-click=\"$select.activate()\"><span ng-show=\"$select.searchEnabled && $select.isEmpty()\" class=\"text-muted\">{{$select.placeholder}}</span> <span ng-hide=\"$select.isEmpty()\" ng-transclude=\"\"></span> <span class=\"caret ui-select-toggle\" ng-click=\"$select.toggle($event)\"></span></button>");
|
960 | 957 | $templateCache.put("bootstrap/select-multiple.tpl.html","<div class=\"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\"></div><div class=\"ui-select-choices\"></div></div>");
|
961 | 958 | $templateCache.put("bootstrap/select.tpl.html","<div class=\"ui-select-bootstrap dropdown\" ng-class=\"{open: $select.open}\"><div class=\"ui-select-match\"></div><input type=\"text\" autocomplete=\"off\" tabindex=\"-1\" 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>");
|
|
0 commit comments