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

Commit 13125f8

Browse files
committed
ran gulp
1 parent 4bb068b commit 13125f8

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
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.12.1 - 2015-07-28T03:50:59.080Z
4+
* Version: 0.12.1 - 2015-08-24T21:57:29.800Z
55
* License: MIT
66
*/
77

dist/select.js

Lines changed: 14 additions & 7 deletions
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.12.1 - 2015-07-28T03:50:59.076Z
4+
* Version: 0.12.1 - 2015-08-24T21:57:29.796Z
55
* License: MIT
66
*/
77

@@ -382,11 +382,11 @@ uis.controller('uiSelectCtrl',
382382
data = data || ctrl.parserResult.source($scope);
383383
var selectedItems = ctrl.selected;
384384
//TODO should implement for single mode removeSelected
385-
if ((angular.isArray(selectedItems) && !selectedItems.length) || !ctrl.removeSelected) {
385+
if (ctrl.isEmpty() || (angular.isArray(selectedItems) && !selectedItems.length) || !ctrl.removeSelected) {
386386
ctrl.setItemsFn(data);
387387
}else{
388388
if ( data !== undefined ) {
389-
var filteredItems = data.filter(function(i) {return selectedItems.indexOf(i) < 0;});
389+
var filteredItems = data.filter(function(i) {return selectedItems && selectedItems.indexOf(i) < 0;});
390390
ctrl.setItemsFn(filteredItems);
391391
}
392392
}
@@ -803,6 +803,9 @@ uis.directive('uiSelect',
803803
$select.onSelectCallback = $parse(attrs.onSelect);
804804
$select.onRemoveCallback = $parse(attrs.onRemove);
805805

806+
//Limit the number of selections allowed
807+
$select.limit = (angular.isDefined(attrs.limit)) ? parseInt(attrs.limit, 10) : undefined;
808+
806809
//Set reference to ngModel from uiSelectCtrl
807810
$select.ngModel = ngModel;
808811

@@ -905,8 +908,8 @@ uis.directive('uiSelect',
905908
if (!contains && !$select.clickTriggeredSelect) {
906909
//Will lose focus only with certain targets
907910
var focusableControls = ['input','button','textarea'];
908-
var targetScope = angular.element(e.target).scope(); //To check if target is other ui-select
909-
var skipFocusser = targetScope && targetScope.$select && targetScope.$select !== $select; //To check if target is other ui-select
911+
var targetController = angular.element(e.target).controller('uiSelect'); //To check if target is other ui-select
912+
var skipFocusser = targetController && targetController !== $select; //To check if target is other ui-select
910913
if (!skipFocusser) skipFocusser = ~focusableControls.indexOf(e.target.tagName.toLowerCase()); //Check if target is input, button or textarea
911914
$select.close(skipFocusser);
912915
scope.$digest();
@@ -1029,7 +1032,7 @@ uis.directive('uiSelect',
10291032
var offsetDropdown = uisOffset(dropdown);
10301033

10311034
// Determine if the direction of the dropdown needs to be changed.
1032-
if (offset.top + offset.height + offsetDropdown.height > $document[0].documentElement.scrollTop + $document[0].documentElement.clientHeight) {
1035+
if (offset.top + offset.height + offsetDropdown.height > $document.scrollTop() + $document[0].documentElement.clientHeight) {
10331036
dropdown[0].style.position = 'absolute';
10341037
dropdown[0].style.top = (offsetDropdown.height * -1) + 'px';
10351038
element.addClass(directionUpClassName);
@@ -1145,7 +1148,7 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
11451148

11461149
ctrl.getPlaceholder = function(){
11471150
//Refactor single?
1148-
if($select.selected.length) return;
1151+
if($select.selected && $select.selected.length) return;
11491152
return $select.placeholder;
11501153
};
11511154

@@ -1244,6 +1247,9 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
12441247
};
12451248

12461249
scope.$on('uis:select', function (event, item) {
1250+
if($select.selected.length >= $select.limit) {
1251+
return;
1252+
}
12471253
$select.selected.push(item);
12481254
$selectMultiple.updateModel();
12491255
});
@@ -1488,6 +1494,7 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
14881494
}
14891495
};
14901496
}]);
1497+
14911498
uis.directive('uiSelectSingle', ['$timeout','$compile', function($timeout, $compile) {
14921499
return {
14931500
restrict: 'EA',

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.

0 commit comments

Comments
 (0)