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

Commit 8fa93b7

Browse files
author
Brian Feister
committed
Rebuild source files post merge
1 parent 2eaf5aa commit 8fa93b7

File tree

5 files changed

+46
-41
lines changed

5 files changed

+46
-41
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.8.3 - 2014-10-14T18:22:05.435Z
4+
* Version: 0.8.3 - 2014-10-17T16:24:21.435Z
55
* License: MIT
66
*/
77

dist/select.js

Lines changed: 42 additions & 30 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.3 - 2014-10-14T18:22:05.432Z
4+
* Version: 0.8.3 - 2014-10-17T16:24:21.429Z
55
* License: MIT
66
*/
77

@@ -59,7 +59,7 @@
5959
*
6060
* jqLite find() is limited to lookups by tag name.
6161
* TODO This will change with future versions of AngularJS, to be removed when this happens
62-
*
62+
5 *
6363
* See jqLite.find - why not use querySelectorAll? https://github.com/angular/angular.js/issues/3586
6464
* See feat(jqLite): use querySelectorAll instead of getElementsByTagName in jqLite.find https://github.com/angular/angular.js/pull/3598
6565
*/
@@ -160,7 +160,7 @@
160160
ctrl.selected = undefined;
161161
ctrl.open = false;
162162
ctrl.focus = false;
163-
ctrl.focusser = undefined; //Reference to input element used to handle focus events
163+
ctrl.focusser = undefined; //Reference to input element used to handle focus events
164164
ctrl.disabled = undefined; // Initialized inside uiSelect directive link function
165165
ctrl.searchEnabled = undefined; // Initialized inside uiSelect directive link function
166166
ctrl.resetSearchInput = undefined; // Initialized inside uiSelect directive link function
@@ -260,7 +260,7 @@
260260
var filteredItems = items.filter(function(i) {return ctrl.selected.indexOf(i) < 0;});
261261
setItemsFn(filteredItems);
262262
}else{
263-
setItemsFn(items);
263+
setItemsFn(items);
264264
}
265265
ctrl.ngModel.$modelValue = null; //Force scope model value and ngModel value to be out of sync to re-run formatters
266266

@@ -270,14 +270,14 @@
270270
});
271271

272272
if (ctrl.multiple){
273-
//Remove already selected items
273+
//Remove already selected items
274274
$scope.$watchCollection('$select.selected', function(selectedItems){
275275
var data = ctrl.parserResult.source($scope);
276276
if (!selectedItems.length) {
277-
setItemsFn(data);
277+
setItemsFn(data);
278278
}else{
279279
var filteredItems = data.filter(function(i) {return selectedItems.indexOf(i) < 0;});
280-
setItemsFn(filteredItems);
280+
setItemsFn(filteredItems);
281281
}
282282
ctrl.sizeSearchInput();
283283
});
@@ -312,17 +312,11 @@
312312
};
313313

314314
ctrl.isActive = function(itemScope) {
315-
<<<<<<< HEAD
316-
if ( typeof itemScope[ctrl.itemProperty] === 'undefined') {
317-
return false;
318-
}
319-
=======
320315
return ctrl.open && ctrl.items.indexOf(itemScope[ctrl.itemProperty]) === ctrl.activeIndex;
321-
>>>>>>> master
322316
};
323317

324318
ctrl.isDisabled = function(itemScope) {
325-
319+
326320
if (!ctrl.open) return;
327321

328322
var itemIndex = ctrl.items.indexOf(itemScope[ctrl.itemProperty]);
@@ -341,7 +335,12 @@
341335
// When the user clicks on an item inside the dropdown
342336
ctrl.select = function(item, skipFocusser) {
343337

344-
if (item === undefined || !item._uiSelectChoiceDisabled) {
338+
if (!item || !item._uiSelectChoiceDisabled) {
339+
if(ctrl.tagging.isActivated && !item && ctrl.search.length > 0) {
340+
// create new item on the fly
341+
item = ctrl.tagging.fct !== undefined ? ctrl.tagging.fct(ctrl.search) : ctrl.search;
342+
}
343+
345344
var locals = {};
346345
locals[ctrl.parserResult.itemName] = item;
347346

@@ -362,7 +361,7 @@
362361

363362
// Closes the dropdown
364363
ctrl.close = function(skipFocusser) {
365-
if (!ctrl.open) return;
364+
if (!ctrl.open) return;
366365
_resetSearchInput();
367366
ctrl.open = false;
368367
if (!ctrl.multiple){
@@ -402,7 +401,7 @@
402401
return ctrl.placeholder;
403402
};
404403

405-
var containerSizeWatch;
404+
var containerSizeWatch;
406405
ctrl.sizeSearchInput = function(){
407406
var input = _searchInput[0],
408407
container = _searchInput.parent().parent()[0];
@@ -436,7 +435,7 @@
436435
break;
437436
case KEY.UP:
438437
if (!ctrl.open && ctrl.multiple) ctrl.activate(false, true); //In case its the search input in 'multiple' mode
439-
else if (ctrl.activeIndex > 0) { ctrl.activeIndex--; }
438+
else if (ctrl.activeIndex > 0 || (ctrl.search.length === 0 && ctrl.tagging.isActivated)) { ctrl.activeIndex--; }
440439
break;
441440
case KEY.TAB:
442441
if (!ctrl.multiple || ctrl.open) ctrl.select(ctrl.items[ctrl.activeIndex], true);
@@ -460,7 +459,7 @@
460459
// Handles selected options in "multiple" mode
461460
function _handleMatchSelection(key){
462461
var caretPosition = _getCaretPosition(_searchInput[0]),
463-
length = ctrl.selected.length,
462+
length = ctrl.selected.length,
464463
// none = -1,
465464
first = 0,
466465
last = length-1,
@@ -483,7 +482,7 @@
483482
break;
484483
case KEY.RIGHT:
485484
// Open drop-down
486-
if(!~ctrl.activeMatchIndex || curr === last){
485+
if(!~ctrl.activeMatchIndex || curr === last){
487486
ctrl.activate();
488487
return false;
489488
}
@@ -506,7 +505,7 @@
506505
return curr;
507506
}
508507
else return false;
509-
}
508+
}
510509
}
511510

512511
newIndex = getNewActiveMatchIndex();
@@ -534,10 +533,10 @@
534533
processed = _handleMatchSelection(key);
535534
}
536535

537-
if (!processed && ctrl.items.length > 0) {
536+
if (!processed && (ctrl.items.length > 0 || ctrl.tagging.isActivated)) {
538537
processed = _handleDropDownSelection(key);
539538
}
540-
539+
541540
if (processed && key != KEY.TAB) {
542541
//TODO Check si el tab selecciona aun correctamente
543542
//Crear test
@@ -643,7 +642,7 @@
643642

644643
//From model --> view
645644
ngModel.$formatters.unshift(function (inputValue) {
646-
var data = $select.parserResult.source (scope, { $select : {search:''}}), //Overwrite $search
645+
var data = $select.parserResult.source (scope, { $select : {search:''}}), //Overwrite $search
647646
locals = {},
648647
result;
649648
if (data){
@@ -695,7 +694,7 @@
695694
if(attrs.tabindex){
696695
//tabindex might be an expression, wait until it contains the actual value before we set the focusser tabindex
697696
attrs.$observe('tabindex', function(value) {
698-
//If we are using multiple, add tabindex to the search input
697+
//If we are using multiple, add tabindex to the search input
699698
if($select.multiple){
700699
searchInput.attr("tabindex", value);
701700
} else {
@@ -750,7 +749,7 @@
750749
if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC || e.which == KEY.ENTER || e.which === KEY.BACKSPACE) {
751750
return;
752751
}
753-
752+
754753
$select.activate(focusser.val()); //User pressed some regular key, so we pass it to the search input
755754
focusser.val('');
756755
scope.$digest();
@@ -776,6 +775,19 @@
776775
$select.resetSearchInput = resetSearchInput !== undefined ? resetSearchInput : true;
777776
});
778777

778+
attrs.$observe('tagging', function() {
779+
if(attrs.tagging !== undefined)
780+
{
781+
// $eval() is needed otherwise we get a string instead of a function or a boolean
782+
var taggingEval = scope.$eval(attrs.tagging);
783+
$select.tagging = {isActivated: true, fct: taggingEval !== true ? taggingEval : undefined};
784+
}
785+
else
786+
{
787+
$select.tagging = {isActivated: false, fct: undefined};
788+
}
789+
});
790+
779791
if ($select.multiple){
780792
scope.$watchCollection(function(){ return ngModel.$modelValue; }, function(newValue, oldValue) {
781793
if (oldValue != newValue)
@@ -879,7 +891,7 @@
879891
if (!tAttrs.repeat) throw uiSelectMinErr('repeat', "Expected 'repeat' expression.");
880892

881893
return function link(scope, element, attrs, $select, transcludeFn) {
882-
894+
883895
// var repeat = RepeatParser.parse(attrs.repeat);
884896
var groupByExp = attrs.groupBy;
885897

@@ -910,7 +922,7 @@
910922

911923
scope.$watch('$select.search', function(newValue) {
912924
if(newValue && !$select.open && $select.multiple) $select.activate(false, true);
913-
$select.activeIndex = 0;
925+
$select.activeIndex = $select.tagging.isActivated ? -1 : 0;
914926
$select.refresh(attrs.refresh);
915927
});
916928

@@ -951,7 +963,7 @@
951963
});
952964

953965
if($select.multiple){
954-
$select.sizeSearchInput();
966+
$select.sizeSearchInput();
955967
}
956968

957969
}
@@ -987,4 +999,4 @@ $templateCache.put("select2/select-multiple.tpl.html","<div class=\"ui-select-mu
987999
$templateCache.put("select2/select.tpl.html","<div class=\"select2 select2-container\" ng-class=\"{\'select2-container-active select2-dropdown-open\': $select.open,\n \'select2-container-disabled\': $select.disabled,\n \'select2-container-active\': $select.focus }\"><div class=\"ui-select-match\"></div><div class=\"select2-drop select2-with-searchbox select2-drop-active\" ng-class=\"{\'select2-display-none\': !$select.open}\"><div class=\"select2-search\" ng-show=\"$select.searchEnabled\"><input type=\"text\" autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\" class=\"ui-select-search select2-input\" ng-model=\"$select.search\"></div><div class=\"ui-select-choices\"></div></div></div>");
9881000
$templateCache.put("selectize/choices.tpl.html","<div ng-show=\"$select.open\" class=\"ui-select-choices selectize-dropdown single\"><div class=\"ui-select-choices-content selectize-dropdown-content\"><div class=\"ui-select-choices-group optgroup\"><div ng-show=\"$select.isGrouped\" class=\"ui-select-choices-group-label optgroup-header\">{{$group.name}}</div><div class=\"ui-select-choices-row\" ng-class=\"{active: $select.isActive(this), disabled: $select.isDisabled(this)}\"><div class=\"option ui-select-choices-row-inner\" data-selectable=\"\"></div></div></div></div></div>");
9891001
$templateCache.put("selectize/match.tpl.html","<div ng-hide=\"$select.searchEnabled && ($select.open || $select.isEmpty())\" class=\"ui-select-match\" ng-transclude=\"\"></div>");
990-
$templateCache.put("selectize/select.tpl.html","<div class=\"selectize-control single\"><div class=\"selectize-input\" ng-class=\"{\'focus\': $select.open, \'disabled\': $select.disabled, \'selectize-focus\' : $select.focus}\" ng-click=\"$select.activate()\"><div class=\"ui-select-match\"></div><input type=\"text\" autocomplete=\"off\" tabindex=\"-1\" class=\"ui-select-search ui-select-toggle\" ng-click=\"$select.toggle($event)\" placeholder=\"{{$select.placeholder}}\" ng-model=\"$select.search\" ng-hide=\"!$select.searchEnabled || ($select.selected && !$select.open)\" ng-disabled=\"$select.disabled\"></div><div class=\"ui-select-choices\"></div></div>");}]);
1002+
$templateCache.put("selectize/select.tpl.html","<div class=\"selectize-control single\"><div class=\"selectize-input\" ng-class=\"{\'focus\': $select.open, \'disabled\': $select.disabled, \'selectize-focus\' : $select.focus}\" ng-click=\"$select.activate()\"><div class=\"ui-select-match\"></div><input type=\"text\" autocomplete=\"off\" tabindex=\"-1\" class=\"ui-select-search ui-select-toggle\" ng-click=\"$select.toggle($event)\" placeholder=\"{{$select.placeholder}}\" ng-model=\"$select.search\" ng-hide=\"!$select.searchEnabled || ($select.selected && !$select.open)\" ng-disabled=\"$select.disabled\"></div><div class=\"ui-select-choices\"></div></div>");}]);

0 commit comments

Comments
 (0)