This repository was archived by the owner on Oct 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add choices grouping using 'group by' expression #49
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,14 +58,14 @@ app.controller('DemoCtrl', function($scope, $http) { | |
|
||
$scope.person = {}; | ||
$scope.people = [ | ||
{ name: 'Adam', email: '[email protected]', age: 10 }, | ||
{ name: 'Amalie', email: '[email protected]', age: 12 }, | ||
{ name: 'Wladimir', email: 'wladimir@email.com', age: 30 }, | ||
{ name: 'Samantha', email: 'samantha@email.com', age: 31 }, | ||
{ name: 'Estefanía', email: 'estefanía@email.com', age: 16 }, | ||
{ name: 'Natasha', email: 'natasha@email.com', age: 54 }, | ||
{ name: 'Nicole', email: '[email protected]', age: 43 }, | ||
{ name: 'Adrian', email: 'adrian@email.com', age: 21 } | ||
{ name: 'Adam', email: '[email protected]', group: 'Foo', age: 12 }, | ||
{ name: 'Amalie', email: '[email protected]', group: 'Foo', age: 12 }, | ||
{ name: 'Estefanía', email: 'estefanía@email.com', group: 'Foo', age: 21 }, | ||
{ name: 'Adrian', email: 'adrian@email.com', group: 'Foo', age: 21 }, | ||
{ name: 'Wladimir', email: 'wladimir@email.com', group: 'Foo', age: 30 }, | ||
{ name: 'Samantha', email: 'samantha@email.com', group: 'bar', age: 30 }, | ||
{ name: 'Nicole', email: '[email protected]', group: 'bar', age: 43 }, | ||
{ name: 'Natasha', email: 'natasha@email.com', group: 'Baz', age: 54 } | ||
]; | ||
|
||
$scope.address = {}; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
<ul class="ui-select-choices ui-select-choices-content dropdown-menu" | ||
role="menu" aria-labelledby="dLabel" | ||
ng-show="$select.items.length > 0"> | ||
<li class="ui-select-choices-row" ng-class="{active: $select.activeIndex === $index}"> | ||
<a class="ui-select-choices-row-inner" href="javascript:void(0)"></a> | ||
<li class="ui-select-choices-group"> | ||
<div class="divider" ng-show="$index > 0"></div> | ||
<div class="ui-select-choices-group-label dropdown-header">{{$group}}</div> | ||
<div class="ui-select-choices-row" ng-class="{active: $select.isActive(this)}"> | ||
<a href="javascript:void(0)" class="ui-select-choices-row-inner"></a> | ||
</div> | ||
</li> | ||
</ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
<ul class="ui-select-choices ui-select-choices-content select2-results"> | ||
<li class="ui-select-choices-row" ng-class="{'select2-highlighted': $select.activeIndex === $index}"> | ||
<div class="select2-result-label ui-select-choices-row-inner"></div> | ||
<li class="ui-select-choices-group"> | ||
<div class="ui-select-choices-group-label select2-result-label">{{$group}}</div> | ||
<ul class="select2-result-sub"> | ||
<li class="ui-select-choices-row" ng-class="{'select2-highlighted': $select.isActive(this)}"> | ||
<div class="select2-result-label ui-select-choices-row-inner"></div> | ||
</li> | ||
</ul> | ||
</li> | ||
</ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
<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-row" | ||
ng-class="{'active': $select.activeIndex === $index}"> | ||
<div class="option ui-select-choices-row-inner" data-selectable></div> | ||
<div class="ui-select-choices-group optgroup"> | ||
<div class="ui-select-choices-group-label optgroup-header">{{$group}}</div> | ||
<div class="ui-select-choices-row" ng-class="{active: $select.isActive(this)}"> | ||
<div class="option ui-select-choices-row-inner" data-selectable></div> | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe cleaner will be if we separate in 2 different structures, one for simple and other grouped cases. This way we can set special css and avoid having unnecessary tags. <ul class="ui-select-choices ui-select-choices-content select2-results">
<!-- Simple -->
<li ng-if="!$select.isGrouped" class="ui-select-choices-row" ng-class="{'select2-highlighted': $select.activeIndex === $index}">
<div class="select2-result-label ui-select-choices-row-inner"></div>
</li>
<!-- Grouped -->
<li ng-if="$select.isGrouped" class="ui-select-choices-group select2-result-with-children">
<div class="ui-select-choices-group-label select2-result-label">{{$group}}</div>
<ul class="select2-result-sub">
<li class="ui-select-choices-row" ng-class="{'select2-highlighted': $select.isActive(this)}">
<div class="select2-result-label ui-select-choices-row-inner"></div>
</li>
</ul>
</li>
</ul> |
||
</div> | ||
</div> | ||
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
beforeEach(function() { | ||
jasmine.addMatchers({ | ||
toHaveClass: function(util, customEqualityTesters) { | ||
return { | ||
compare: function(actual, cls) { | ||
var pass = actual.hasClass(cls); | ||
return { | ||
pass: pass, | ||
message: "Expected '" + actual + "'" + (pass ? ' not ' : ' ') + "to have class '" + cls + "'." | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using the down/up keys to move selected value in "grouped mode", it isn't working correctly since the activeIndex is not in same order are if the items aren't grouped. Maybe saving current group could help, but some refactor will be needed at https://github.com/angular-ui/ui-select/blob/master/src/select.js#L225