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

Commit 4ebad63

Browse files
committed
chore(build): v0.8.2
1 parent f6c0e1f commit 4ebad63

File tree

6 files changed

+38
-22
lines changed

6 files changed

+38
-22
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ui-select",
3-
"version": "0.8.1",
3+
"version": "0.8.2",
44
"homepage": "https://github.com/angular-ui/ui-select",
55
"authors": [
66
"AngularUI"

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.1 - 2014-10-07T21:36:20.169Z
4+
* Version: 0.8.2 - 2014-10-09T23:29:49.716Z
55
* License: MIT
66
*/
77

dist/select.js

Lines changed: 32 additions & 16 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.8.1 - 2014-10-07T21:36:20.165Z
4+
* Version: 0.8.2 - 2014-10-09T23:29:49.713Z
55
* License: MIT
66
*/
77

@@ -27,9 +27,11 @@
2727
END: 35,
2828
BACKSPACE: 8,
2929
DELETE: 46,
30+
COMMAND: 91,
3031
isControl: function (e) {
3132
var k = e.which;
3233
switch (k) {
34+
case KEY.COMMAND:
3335
case KEY.SHIFT:
3436
case KEY.CTRL:
3537
case KEY.ALT:
@@ -190,6 +192,7 @@
190192
ctrl.activate = function(initSearchValue, avoidReset) {
191193
if (!ctrl.disabled && !ctrl.open) {
192194
if(!avoidReset) _resetSearchInput();
195+
ctrl.focusser.prop('disabled', true); //Will reactivate it on .close()
193196
ctrl.open = true;
194197
ctrl.activeMatchIndex = -1;
195198

@@ -309,10 +312,13 @@
309312
};
310313

311314
ctrl.isActive = function(itemScope) {
312-
return ctrl.items.indexOf(itemScope[ctrl.itemProperty]) === ctrl.activeIndex;
315+
return ctrl.open && ctrl.items.indexOf(itemScope[ctrl.itemProperty]) === ctrl.activeIndex;
313316
};
314317

315318
ctrl.isDisabled = function(itemScope) {
319+
320+
if (!ctrl.open) return;
321+
316322
var itemIndex = ctrl.items.indexOf(itemScope[ctrl.itemProperty]);
317323
var isDisabled = false;
318324
var item;
@@ -327,9 +333,9 @@
327333
};
328334

329335
// When the user clicks on an item inside the dropdown
330-
ctrl.select = function(item) {
336+
ctrl.select = function(item, skipFocusser) {
331337

332-
if (!item._uiSelectChoiceDisabled) {
338+
if (item === undefined || !item._uiSelectChoiceDisabled) {
333339
var locals = {};
334340
locals[ctrl.parserResult.itemName] = item;
335341

@@ -344,17 +350,19 @@
344350
} else {
345351
ctrl.selected = item;
346352
}
347-
ctrl.close();
353+
ctrl.close(skipFocusser);
348354
}
349355
};
350356

351357
// Closes the dropdown
352-
ctrl.close = function() {
353-
if (ctrl.open) {
354-
_resetSearchInput();
355-
ctrl.open = false;
358+
ctrl.close = function(skipFocusser) {
359+
if (!ctrl.open) return;
360+
_resetSearchInput();
361+
ctrl.open = false;
362+
if (!ctrl.multiple){
356363
$timeout(function(){
357-
ctrl.focusser[0].focus();
364+
ctrl.focusser.prop('disabled', false);
365+
if (!skipFocusser) ctrl.focusser[0].focus();
358366
},0,false);
359367
}
360368
};
@@ -368,9 +376,18 @@
368376

369377
// Remove item from multiple select
370378
ctrl.removeChoice = function(index){
379+
var removedChoice = ctrl.selected[index];
380+
var locals = {};
381+
locals[ctrl.parserResult.itemName] = removedChoice;
382+
371383
ctrl.selected.splice(index, 1);
372384
ctrl.activeMatchIndex = -1;
373385
ctrl.sizeSearchInput();
386+
387+
ctrl.onRemoveCallback($scope, {
388+
$item: removedChoice,
389+
$model: ctrl.parserResult.modelMapper($scope, locals)
390+
});
374391
};
375392

376393
ctrl.getPlaceholder = function(){
@@ -402,8 +419,7 @@
402419
else if (ctrl.activeIndex > 0) { ctrl.activeIndex--; }
403420
break;
404421
case KEY.TAB:
405-
//TODO: Que hacemos en modo multiple?
406-
if (!ctrl.multiple) ctrl.select(ctrl.items[ctrl.activeIndex]);
422+
if (!ctrl.multiple || ctrl.open) ctrl.select(ctrl.items[ctrl.activeIndex], true);
407423
break;
408424
case KEY.ENTER:
409425
if(ctrl.open){
@@ -497,7 +513,7 @@
497513
if(ctrl.multiple && KEY.isHorizontalMovement(key)){
498514
processed = _handleMatchSelection(key);
499515
}
500-
516+
501517
if (!processed && ctrl.items.length > 0) {
502518
processed = _handleDropDownSelection(key);
503519
}
@@ -519,7 +535,6 @@
519535
_searchInput.on('blur', function() {
520536
$timeout(function() {
521537
ctrl.activeMatchIndex = -1;
522-
ctrl.activeIndex = 0;
523538
});
524539
});
525540

@@ -580,9 +595,10 @@
580595

581596
var searchInput = element.querySelectorAll('input.ui-select-search');
582597

583-
$select.multiple = angular.isDefined(attrs.multiple);
598+
$select.multiple = (angular.isDefined(attrs.multiple)) ? (attrs.multiple === '') ? true : (attrs.multiple.toLowerCase() === 'true') : false;
584599

585600
$select.onSelectCallback = $parse(attrs.onSelect);
601+
$select.onRemoveCallback = $parse(attrs.onRemove);
586602

587603
//From view --> model
588604
ngModel.$parsers.unshift(function (inputValue) {
@@ -692,7 +708,7 @@
692708
e.preventDefault();
693709
e.stopPropagation();
694710
$select.select(undefined);
695-
scope.$digest();
711+
scope.$apply();
696712
return;
697713
}
698714

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.

package.json

Lines changed: 1 addition & 1 deletion
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.8.1",
9+
"version": "0.8.2",
1010
"devDependencies": {
1111
"bower": "~1.3",
1212
"del": "~0.1.1",

0 commit comments

Comments
 (0)