6
6
*/
7
7
8
8
9
- ( function ( ) {
9
+ ( function ( ) {
10
10
"use strict" ;
11
11
12
12
var KEY = {
@@ -284,7 +284,7 @@ uis.controller('uiSelectCtrl',
284
284
if ( ctrl . searchInput . length !== 1 ) {
285
285
throw uiSelectMinErr ( 'searchInput' , "Expected 1 input.ui-select-search but got '{0}'." , ctrl . searchInput . length ) ;
286
286
}
287
-
287
+
288
288
ctrl . isEmpty = function ( ) {
289
289
return angular . isUndefined ( ctrl . selected ) || ctrl . selected === null || ctrl . selected === '' ;
290
290
} ;
@@ -314,7 +314,7 @@ uis.controller('uiSelectCtrl',
314
314
315
315
// When the user clicks on ui-select, displays the dropdown list
316
316
ctrl . activate = function ( initSearchValue , avoidReset ) {
317
- if ( ! ctrl . disabled && ! ctrl . open ) {
317
+ if ( ! ctrl . disabled && ! ctrl . open && ctrl . search . length > 2 ) {
318
318
if ( ! avoidReset ) _resetSearchInput ( ) ;
319
319
320
320
$scope . $broadcast ( 'uis:activate' ) ;
@@ -388,7 +388,7 @@ uis.controller('uiSelectCtrl',
388
388
//If collection is an Object, convert it to Array
389
389
390
390
var originalSource = ctrl . parserResult . source ;
391
-
391
+
392
392
//When an object is used as source, we better create an array and use it as 'source'
393
393
var createArrayFromObject = function ( ) {
394
394
$scope . $uisSource = Object . keys ( originalSource ( $scope ) ) . map ( function ( v ) {
@@ -433,7 +433,7 @@ uis.controller('uiSelectCtrl',
433
433
ctrl . items = [ ] ;
434
434
} else {
435
435
if ( ! angular . isArray ( items ) ) {
436
- throw uiSelectMinErr ( 'items' , "Expected an array but got '{0}'." , items ) ;
436
+ throw uiSelectMinErr ( 'items' , "Expected an array but got '{0}'." , items ) ;
437
437
} else {
438
438
//Remove already selected items (ex: while searching)
439
439
//TODO Should add a test
@@ -1180,7 +1180,7 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
1180
1180
$select = $scope . $select ,
1181
1181
ngModel ;
1182
1182
1183
- //Wait for link fn to inject it
1183
+ //Wait for link fn to inject it
1184
1184
$scope . $evalAsync ( function ( ) { ngModel = $scope . ngModel ; } ) ;
1185
1185
1186
1186
ctrl . activeMatchIndex = - 1 ;
@@ -1192,7 +1192,7 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
1192
1192
1193
1193
ctrl . refreshComponent = function ( ) {
1194
1194
//Remove already selected items
1195
- //e.g. When user clicks on a selection, the selected array changes and
1195
+ //e.g. When user clicks on a selection, the selected array changes and
1196
1196
//the dropdown should remove that item
1197
1197
$select . refreshItems ( ) ;
1198
1198
$select . sizeSearchInput ( ) ;
@@ -1291,7 +1291,7 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
1291
1291
} ;
1292
1292
if ( ! inputValue ) return resultMultiple ; //If ngModel was undefined
1293
1293
for ( var k = inputValue . length - 1 ; k >= 0 ; k -- ) {
1294
- //Check model array of currently selected items
1294
+ //Check model array of currently selected items
1295
1295
if ( ! checkFnMultiple ( $select . selected , inputValue [ k ] ) ) {
1296
1296
//Check model array of all items available
1297
1297
if ( ! checkFnMultiple ( data , inputValue [ k ] ) ) {
@@ -1302,8 +1302,8 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
1302
1302
}
1303
1303
return resultMultiple ;
1304
1304
} ) ;
1305
-
1306
- //Watch for external model changes
1305
+
1306
+ //Watch for external model changes
1307
1307
scope . $watchCollection ( function ( ) { return ngModel . $modelValue ; } , function ( newValue , oldValue ) {
1308
1308
if ( oldValue != newValue ) {
1309
1309
ngModel . $modelValue = null ; //Force scope model value and ngModel value to be out of sync to re-run formatters
@@ -1431,7 +1431,7 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
1431
1431
} ) ;
1432
1432
}
1433
1433
// Push a "create new" item into array if there is a search string
1434
- if ( $select . tagging . isActivated && $select . search . length > 0 ) {
1434
+ if ( $select . tagging . isActivated && $select . search . length > 2 ) {
1435
1435
1436
1436
// return early with these keys
1437
1437
if ( e . which === KEY . TAB || KEY . isControl ( e ) || KEY . isFunctionKey ( e ) || e . which === KEY . ESC || KEY . isVerticalMovement ( e . which ) ) {
@@ -1864,7 +1864,7 @@ uis.service('uisRepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinE
1864
1864
1865
1865
// if (isObjectCollection){
1866
1866
//00000000000000000000000000000111111111000000000000000222222222222220033333333333333333333330000444444444444444444000000000000000556666660000077777777777755000000000000000000000088888880000000
1867
- match = expression . match ( / ^ \s * (?: ( [ \s \S ] + ?) \s + a s \s + ) ? (?: ( [ \$ \w ] [ \$ \w ] * ) | (?: \( \s * ( [ \$ \w ] [ \$ \w ] * ) \s * , \s * ( [ \$ \w ] [ \$ \w ] * ) \s * \) ) ) \s + i n \s + ( ( [ \w ] + ) ? \s * ( | \s * [ \s \S ] + ?) ) ? (?: \s + t r a c k \s + b y \s + ( [ \s \S ] + ?) ) ? \s * $ / ) ;
1867
+ match = expression . match ( / ^ \s * (?: ( [ \s \S ] + ?) \s + a s \s + ) ? (?: ( [ \$ \w ] [ \$ \w ] * ) | (?: \( \s * ( [ \$ \w ] [ \$ \w ] * ) \s * , \s * ( [ \$ \w ] [ \$ \w ] * ) \s * \) ) ) \s + i n \s + ( ( [ \w ] + ) ? \s * ( | \s * [ \s \S ] + ?) ) ? (?: \s + t r a c k \s + b y \s + ( [ \s \S ] + ?) ) ? \s * $ / ) ;
1868
1868
1869
1869
// 1 Alias
1870
1870
// 2 Item
@@ -1898,7 +1898,7 @@ uis.service('uisRepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinE
1898
1898
expression += ' track by ' + this . trackByExp ;
1899
1899
}
1900
1900
return expression ;
1901
- }
1901
+ }
1902
1902
} ;
1903
1903
1904
1904
} ;
@@ -1922,4 +1922,4 @@ $templateCache.put("select2/select-multiple.tpl.html","<div class=\"ui-select-co
1922
1922
$templateCache . put ( "select2/select.tpl.html" , "<div class=\"ui-select-container select2 select2-container\" ng-class=\"{\'select2-container-active select2-dropdown-open open\': $select.open, \'select2-container-disabled\': $select.disabled, \'select2-container-active\': $select.focus, \'select2-allowclear\': $select.allowClear && !$select.isEmpty()}\"><div class=\"ui-select-match\"></div><div class=\"ui-select-dropdown 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=\"false\" autocorrect=\"false\" autocapitalize=\"off\" spellcheck=\"false\" role=\"combobox\" aria-expanded=\"true\" aria-owns=\"ui-select-choices-{{ $select.generatedId }}\" aria-label=\"{{ $select.baseTitle }}\" aria-activedescendant=\"ui-select-choices-row-{{ $select.generatedId }}-{{ $select.activeIndex }}\" class=\"ui-select-search select2-input\" ng-model=\"$select.search\"></div><div class=\"ui-select-choices\"></div></div></div>" ) ;
1923
1923
$templateCache . put ( "selectize/choices.tpl.html" , "<div ng-show=\"$select.open\" class=\"ui-select-choices ui-select-dropdown selectize-dropdown single\"><div class=\"ui-select-choices-content selectize-dropdown-content\"><div class=\"ui-select-choices-group optgroup\" role=\"listbox\"><div ng-show=\"$select.isGrouped\" class=\"ui-select-choices-group-label optgroup-header\" ng-bind=\"$group.name\"></div><div role=\"option\" 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>" ) ;
1924
1924
$templateCache . put ( "selectize/match.tpl.html" , "<div ng-hide=\"($select.open || $select.isEmpty())\" class=\"ui-select-match\" ng-transclude=\"\"></div>" ) ;
1925
- $templateCache . put ( "selectize/select.tpl.html" , "<div class=\"ui-select-container selectize-control single\" ng-class=\"{\'open\': $select.open}\"><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=\"false\" 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\" aria-label=\"{{ $select.baseTitle }}\"></div><div class=\"ui-select-choices\"></div></div>" ) ; } ] ) ;
1925
+ $templateCache . put ( "selectize/select.tpl.html" , "<div class=\"ui-select-container selectize-control single\" ng-class=\"{\'open\': $select.open}\"><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=\"false\" 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\" aria-label=\"{{ $select.baseTitle }}\"></div><div class=\"ui-select-choices\"></div></div>" ) ; } ] ) ;
0 commit comments