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

Commit f2e68f1

Browse files
author
Kerry McCullough
committed
chore(release): bump package version and update changelog
1 parent 9230b43 commit f2e68f1

File tree

8 files changed

+74
-29
lines changed

8 files changed

+74
-29
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
<a name="0.14.10"></a>
2+
## [0.14.10](https://github.com/angular-ui/ui-select/compare/v0.14.9...v0.14.10) (2016-03-07)
3+
4+
5+
6+
17
<a name="0.14.9"></a>
28
## [0.14.9](https://github.com/angular-ui/ui-select/compare/v0.14.9...v0.14.9) (2016-03-06)
39

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.14.8 - 2016-02-18T22:01:43.880Z
4+
* Version: 0.14.10 - 2016-03-07T18:29:24.965Z
55
* License: MIT
66
*/
77

dist/select.js

Lines changed: 48 additions & 19 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.14.8 - 2016-02-18T22:01:43.792Z
4+
* Version: 0.14.10 - 2016-03-07T18:29:24.905Z
55
* License: MIT
66
*/
77

@@ -482,7 +482,11 @@ uis.controller('uiSelectCtrl',
482482
ctrl.setItemsFn(data);
483483
}else{
484484
if ( data !== undefined ) {
485-
var filteredItems = data.filter(function(i) {return selectedItems && selectedItems.indexOf(i) < 0;});
485+
var filteredItems = data.filter(function(i) {
486+
return selectedItems.every(function(selectedItem) {
487+
return !angular.equals(i, selectedItem);
488+
});
489+
});
486490
ctrl.setItemsFn(filteredItems);
487491
}
488492
}
@@ -940,6 +944,11 @@ uis.directive('uiSelect',
940944
//Set reference to ngModel from uiSelectCtrl
941945
$select.ngModel = ngModel;
942946

947+
//Properly check for empty if set to multiple
948+
ngModel.$isEmpty = function(value) {
949+
return !value || angular.isDefined(attrs.multiple) && value.length === 0;
950+
};
951+
943952
$select.choiceGrouped = function(group){
944953
return $select.isGrouped && group && group.name;
945954
};
@@ -1580,9 +1589,19 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
15801589
stashArr = stashArr.slice(1,stashArr.length);
15811590
}
15821591
newItem = $select.tagging.fct($select.search);
1583-
newItem.isTag = true;
1584-
// verify the the tag doesn't match the value of an existing item
1585-
if ( stashArr.filter( function (origItem) { return angular.equals( origItem, $select.tagging.fct($select.search) ); } ).length > 0 ) {
1592+
// verify the new tag doesn't match the value of a possible selection choice or an already selected item.
1593+
if (
1594+
stashArr.some(function (origItem) {
1595+
return angular.equals(origItem, $select.tagging.fct($select.search));
1596+
}) ||
1597+
$select.selected.some(function (origItem) {
1598+
return angular.equals(origItem, newItem);
1599+
})
1600+
) {
1601+
scope.$evalAsync(function () {
1602+
$select.activeIndex = 0;
1603+
$select.items = items;
1604+
});
15861605
return;
15871606
}
15881607
newItem.isTag = true;
@@ -1977,38 +1996,48 @@ uis.service('uisRepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinE
19771996

19781997

19791998
var match;
1980-
var isObjectCollection = /\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)/.test(expression);
1999+
//var isObjectCollection = /\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)/.test(expression);
19812000
// If an array is used as collection
19822001

19832002
// if (isObjectCollection){
1984-
//00000000000000000000000000000111111111000000000000000222222222222220033333333333333333333330000444444444444444444000000000000000556666660000077777777777755000000000000000000000088888880000000
1985-
match = expression.match(/^\s*(?:([\s\S]+?)\s+as\s+)?(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(([\w\.]+)?\s*(|\s*[\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
2003+
// 000000000000000000000000000000111111111000000000000000222222222222220033333333333333333333330000444444444444444444000000000000000055555555555000000000000000000000066666666600000000
2004+
match = expression.match(/^\s*(?:([\s\S]+?)\s+as\s+)?(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(\s*[\s\S]+?)?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
19862005

19872006
// 1 Alias
19882007
// 2 Item
19892008
// 3 Key on (key,value)
19902009
// 4 Value on (key,value)
1991-
// 5 Collection expresion (only used when using an array collection)
1992-
// 6 Object that will be converted to Array when using (key,value) syntax
1993-
// 7 Filters that will be applied to #6 when using (key,value) syntax
1994-
// 8 Track by
2010+
// 5 Source expression (including filters)
2011+
// 6 Track by
19952012

19962013
if (!match) {
19972014
throw uiSelectMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",
19982015
expression);
19992016
}
2000-
if (!match[6] && isObjectCollection) {
2001-
throw uiSelectMinErr('iexp', "Expected expression in form of '_item_ as (_key_, _item_) in _ObjCollection_ [ track by _id_]' but got '{0}'.",
2002-
expression);
2017+
2018+
var source = match[5],
2019+
filters = '';
2020+
2021+
// When using (key,value) ui-select requires filters to be extracted, since the object
2022+
// is converted to an array for $select.items
2023+
// (in which case the filters need to be reapplied)
2024+
if (match[3]) {
2025+
// Remove any enclosing parenthesis
2026+
source = match[5].replace(/(^\()|(\)$)/g, '');
2027+
// match all after | but not after ||
2028+
var filterMatch = match[5].match(/^\s*(?:[\s\S]+?)(?:[^\|]|\|\|)+([\s\S]*)\s*$/);
2029+
if(filterMatch && filterMatch[1].trim()) {
2030+
filters = filterMatch[1];
2031+
source = source.replace(filters, '');
2032+
}
20032033
}
20042034

20052035
return {
20062036
itemName: match[4] || match[2], // (lhs) Left-hand side,
20072037
keyName: match[3], //for (key, value) syntax
2008-
source: $parse(!match[3] ? match[5] : match[6]),
2009-
sourceName: match[6],
2010-
filters: match[7],
2011-
trackByExp: match[8],
2038+
source: $parse(source),
2039+
filters: filters,
2040+
trackByExp: match[6],
20122041
modelMapper: $parse(match[1] || match[4] || match[2]),
20132042
repeatExpression: function (grouped) {
20142043
var expression = this.itemName + ' in ' + (grouped ? '$group.items' : '$select.items');

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
@@ -7,7 +7,7 @@
77
"url": "git://github.com/angular-ui/ui-select.git"
88
},
99
"style": "dist/select.css",
10-
"version": "0.14.10",
10+
"version": "0.14.11",
1111
"devDependencies": {
1212
"bower": "~1.3",
1313
"conventional-changelog": "^0.5.3",

src/uiSelectDirective.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ uis.directive('uiSelect',
6161
//Set reference to ngModel from uiSelectCtrl
6262
$select.ngModel = ngModel;
6363

64+
//Properly check for empty if set to multiple
65+
ngModel.$isEmpty = function(value) {
66+
return !value || angular.isDefined(attrs.multiple) && value.length === 0;
67+
};
68+
6469
$select.choiceGrouped = function(group){
6570
return $select.isGrouped && group && group.name;
6671
};

test/select.spec.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ describe('ui-select tests', function() {
260260

261261
});
262262

263-
it('should parse simple property binding repeat syntax with a basic filter', function () {
263+
it('should parse simple property binding repeat syntax with a basic filter', function () {
264264

265265
var locals = {};
266266
locals.people = [{ name: 'Wladimir' }, { name: 'Samantha' }];
@@ -269,11 +269,11 @@ describe('ui-select tests', function() {
269269
var parserResult = uisRepeatParser.parse('person.name as person in people | filter: { name: \'Samantha\' }');
270270
expect(parserResult.itemName).toBe('person');
271271
expect(parserResult.modelMapper(locals)).toBe(locals.person.name);
272-
expect(parserResult.source(locals)).toEqual([locals.person]);
272+
expect(parserResult.source(locals)).toEqual([locals.person]);
273273

274274
});
275275

276-
it('should parse simple property binding repeat syntax with track by', function () {
276+
it('should parse simple property binding repeat syntax with track by', function () {
277277

278278
var locals = {};
279279
locals.people = [{ name: 'Wladimir' }, { name: 'Samantha' }];
@@ -282,8 +282,8 @@ describe('ui-select tests', function() {
282282
var parserResult = uisRepeatParser.parse('person.name as person in people track by person.name');
283283
expect(parserResult.itemName).toBe('person');
284284
expect(parserResult.modelMapper(locals)).toBe(locals.person.name);
285-
expect(parserResult.source(locals)).toBe(locals.people);
286-
285+
expect(parserResult.source(locals)).toBe(locals.people);
286+
287287
});
288288

289289
it('should parse (key, value) repeat syntax', function() {
@@ -2220,6 +2220,11 @@ describe('ui-select tests', function() {
22202220
expect(searchEl.length).toEqual(1);
22212221
expect(searchEl[0].id).toEqual('inid');
22222222
});
2223+
2224+
it('should properly check for empty if required', function () {
2225+
var el = createUiSelectMultiple({required: true});
2226+
expect(el.hasClass('ng-invalid-required')).toBeTruthy();
2227+
});
22232228
});
22242229

22252230
it('should add an id to the search input field', function () {

0 commit comments

Comments
 (0)