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

Commit 96771a2

Browse files
committed
feat(Header & Footer): Add header & footer to the dropdown list.
1 parent 32829a3 commit 96771a2

20 files changed

+326
-93
lines changed
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<h3>Basic Header and Footer</h3>
2+
<button class="btn btn-default btn-xs" ng-click="ctrl.enable()">Enable ui-select</button>
3+
<button class="btn btn-default btn-xs" ng-click="ctrl.disable()">Disable ui-select</button>
4+
<button class="btn btn-default btn-xs" ng-click="ctrl.clear()">Clear ng-model</button>
5+
6+
<h3>Bootstrap theme <small>(remote data source)</small></h3>
7+
<p>Selected: {{ctrl.address.selected.formatted_address}}</p>
8+
<ui-select ng-model="ctrl.address.selected"
9+
theme="bootstrap"
10+
ng-disabled="ctrl.disabled"
11+
reset-search-input="false"
12+
style="width: 400px;"
13+
title="Choose an address">
14+
<ui-select-match placeholder="Enter an address...">{{$select.selected.formatted_address}}</ui-select-match>
15+
<ui-select-header>Header text</ui-select-header>
16+
<ui-select-choices repeat="address in ctrl.addresses track by $index"
17+
refresh="ctrl.refreshAddresses($select.search)"
18+
refresh-delay="0">
19+
<div ng-bind-html="address.formatted_address | highlight: $select.search"></div>
20+
</ui-select-choices>
21+
<ui-select-footer>Footer text</ui-select-footer>
22+
</ui-select>
23+
24+
<h3>Select2 theme</h3>
25+
<p>Selected: {{ctrl.person.selected}}</p>
26+
<ui-select ng-model="ctrl.person.selected" theme="select2" ng-disabled="ctrl.disabled" style="min-width: 300px;" title="Choose a person">
27+
<ui-select-match placeholder="Select a person in the list or search his name/age...">{{$select.selected.name}}</ui-select-match>
28+
<ui-select-header>Header text</ui-select-header>
29+
<ui-select-choices repeat="person in ctrl.people | propsFilter: {name: $select.search, age: $select.search}">
30+
<div ng-bind-html="person.name | highlight: $select.search"></div>
31+
<small>
32+
email: {{person.email}}
33+
age: <span ng-bind-html="''+person.age | highlight: $select.search"></span>
34+
</small>
35+
</ui-select-choices>
36+
<ui-select-footer>Footer text</ui-select-footer>
37+
</ui-select>
38+
39+
<h3>Selectize theme</h3>
40+
<p>Selected: {{ctrl.country.selected}}</p>
41+
<ui-select ng-model="ctrl.country.selected" theme="selectize" ng-disabled="ctrl.disabled" style="width: 300px;" title="Choose a country">
42+
<ui-select-match placeholder="Select or search a country in the list...">{{$select.selected.name}}</ui-select-match>
43+
<ui-select-header>Header text</ui-select-header>
44+
<ui-select-choices repeat="country in ctrl.countries | filter: $select.search">
45+
<span ng-bind-html="country.name | highlight: $select.search"></span>
46+
<small ng-bind-html="country.code | highlight: $select.search"></small>
47+
</ui-select-choices>
48+
<ui-select-footer>Footer text</ui-select-footer>
49+
</ui-select>

src/bootstrap/choices.tpl.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<ul class="ui-select-choices ui-select-choices-content ui-select-dropdown dropdown-menu"
2-
ng-show="$select.open && $select.items.length > 0">
1+
<ul class="ui-select-choices ui-select-choices-content">
32
<li class="ui-select-choices-group" id="ui-select-choices-{{ $select.generatedId }}" >
43
<div class="divider" ng-show="$select.isGrouped && $index > 0"></div>
54
<div ng-show="$select.isGrouped" class="ui-select-choices-group-label dropdown-header" ng-bind="$group.name"></div>

src/bootstrap/footer.tpl.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div class="ui-select-footer" ng-transclude></div>

src/bootstrap/header.tpl.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div class="ui-select-header" ng-transclude></div>

src/bootstrap/select-multiple.tpl.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
ng-class="{'spinner': $select.refreshing}"
1818
ondrop="return false;">
1919
</div>
20-
<div class="ui-select-choices"></div>
20+
<div ng-show="$select.open && $select.items.length > 0" class="ui-select-dropdown dropdown-menu">
21+
<div class="ui-select-header"></div>
22+
<div class="ui-select-choices"></div>
23+
<div class="ui-select-footer"></div>
24+
</div>
2125
<div class="ui-select-no-choice"></div>
2226
</div>

src/bootstrap/select.tpl.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
placeholder="{{$select.placeholder}}"
1111
ng-model="$select.search"
1212
ng-show="$select.open">
13-
<div class="ui-select-choices"></div>
13+
<div ng-show="$select.open && $select.items.length > 0" class="ui-select-dropdown dropdown-menu">
14+
<div class="ui-select-header"></div>
15+
<div class="ui-select-choices"></div>
16+
<div class="ui-select-footer"></div>
17+
</div>
1418
<div class="ui-select-no-choice"></div>
1519
</div>

0 commit comments

Comments
 (0)