11/*!
22 * ui-select
33 * http://github.com/angular-ui/ui-select
4- * Version: 0.13.0 - 2015-09-29T17:48:20.967Z
4+ * Version: 0.13.1 - 2015-09-30T05:39:26.655Z
55 * License: MIT
66 */
77
@@ -394,7 +394,7 @@ uis.controller('uiSelectCtrl',
394394 $scope . $uisSource = Object . keys ( originalSource ( $scope ) ) . map ( function ( v ) {
395395 var result = { } ;
396396 result [ ctrl . parserResult . keyName ] = v ;
397- result . value = $scope [ ctrl . parserResult . sourceName ] [ v ] ;
397+ result . value = $scope . peopleObj [ v ] ;
398398 return result ;
399399 } ) ;
400400 } ;
@@ -408,7 +408,6 @@ uis.controller('uiSelectCtrl',
408408 }
409409
410410 ctrl . refreshItems = function ( data ) {
411- $scope . calculateDropdownPos ( ) ;
412411 data = data || ctrl . parserResult . source ( $scope ) ;
413412 var selectedItems = ctrl . selected ;
414413 //TODO should implement for single mode removeSelected
@@ -420,6 +419,9 @@ uis.controller('uiSelectCtrl',
420419 ctrl . setItemsFn ( filteredItems ) ;
421420 }
422421 }
422+ if ( ctrl . dropdownPosition === 'auto' || ctrl . dropdownPosition === 'up' ) {
423+ $scope . calculateDropdownPos ( ) ;
424+ }
423425 } ;
424426
425427 // See https://github.com/angular/angular.js/blob/v1.2.15/src/ng/directive/ngRepeat.js#L259
@@ -1853,21 +1855,39 @@ uis.service('uisRepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinE
18531855 self . parse = function ( expression ) {
18541856
18551857
1856- //0000000000000000000000000000000000011111111100000000000000022222222222222003333333333333333333333000044444444444444444400000000000000005555500000666666666666600000000000000000000007777777770000000
1857- var 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 * $ / ) ;
1858+ var match ;
1859+ var isObjectCollection = / \( \s * ( [ \$ \w ] [ \$ \w ] * ) \s * , \s * ( [ \$ \w ] [ \$ \w ] * ) \s * \) / . test ( expression ) ;
1860+ // If an array is used as collection
1861+
1862+ // if (isObjectCollection){
1863+ //00000000000000000000000000000111111111000000000000000222222222222220033333333333333333333330000444444444444444444000000000000000556666660000077777777777755000000000000000000000088888880000000
1864+ 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 * $ / ) ;
1865+
1866+ // 1 Alias
1867+ // 2 Item
1868+ // 3 Key on (key,value)
1869+ // 4 Value on (key,value)
1870+ // 5 Collection expresion (only used when using an array collection)
1871+ // 6 Object that will be converted to Array when using (key,value) syntax
1872+ // 7 Filters that will be applied to #6 when using (key,value) syntax
1873+ // 8 Track by
18581874
18591875 if ( ! match ) {
18601876 throw uiSelectMinErr ( 'iexp' , "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'." ,
18611877 expression ) ;
18621878 }
1879+ if ( ! match [ 6 ] && isObjectCollection ) {
1880+ throw uiSelectMinErr ( 'iexp' , "Expected expression in form of '_item_ as (_key_, _item_) in _ObjCollection_ [ track by _id_]' but got '{0}'." ,
1881+ expression ) ;
1882+ }
18631883
18641884 return {
18651885 itemName : match [ 4 ] || match [ 2 ] , // (lhs) Left-hand side,
18661886 keyName : match [ 3 ] , //for (key, value) syntax
1867- source : $parse ( ! match [ 3 ] ? match [ 5 ] + ( match [ 6 ] || '' ) : match [ 5 ] ) , //concat source with filters if its an array
1868- sourceName : match [ 5 ] ,
1869- filters : match [ 6 ] ,
1870- trackByExp : match [ 7 ] ,
1887+ source : $parse ( ! match [ 3 ] ? match [ 5 ] : match [ 6 ] ) ,
1888+ sourceName : match [ 6 ] ,
1889+ filters : match [ 7 ] ,
1890+ trackByExp : match [ 8 ] ,
18711891 modelMapper : $parse ( match [ 1 ] || match [ 4 ] || match [ 2 ] ) ,
18721892 repeatExpression : function ( grouped ) {
18731893 var expression = this . itemName + ' in ' + ( grouped ? '$group.items' : '$select.items' ) ;
0 commit comments