Skip to content

Commit 4336131

Browse files
Merge branch 'master-local' into master-dist
2 parents 8152798 + 0f5d408 commit 4336131

File tree

68 files changed

+2555
-136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2555
-136
lines changed

Gruntfile.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ module.exports = function (grunt) {
168168
image: 'misc/logo-alt.svg',
169169
scripts: [
170170
'node_modules/jquery/dist/jquery.js',
171+
'node_modules/bootstrap/dist/js/bootstrap.min.js',
172+
'node_modules/bootstrap-select/js/bootstrap-select.js',
171173
'node_modules/components-jqueryui/jquery-ui.min.js',
172174
'node_modules/datatables.net/js/jquery.dataTables.js',
173175
'node_modules/datatables.net-select/js/dataTables.select.js',

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ Note:
7979
<!-- Angular -->
8080
<script src="node_modules/angular-patternfly/node_modules/angular/angular.min.js"></script>
8181
82+
<!-- Bootstrap-Select (Optional): The following lines are only required if you use the pfBootstrapSelect directive -->
83+
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
84+
<script src="node_modules/bootstrap-select/js/bootstrap-select.js"></script>
85+
8286
<!-- Angular-Bootstrap -->
8387
<script src="node_modules/angular-patternfly/node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js"></script>
8488
<script src="node_modules/angular-patternfly/node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js"></script>

dist/angular-patternfly.js

Lines changed: 116 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11905,6 +11905,120 @@ angular.module('patternfly.pagination').component('pfPagination', {
1190511905
}
1190611906
}]
1190711907
});
11908+
;angular.module('patternfly.select').directive('pfBootstrapSelect', function () {
11909+
'use strict';
11910+
11911+
return {
11912+
restrict: 'A',
11913+
require: '?ngModel',
11914+
scope: {
11915+
selectPickerOptions: '=pfBootstrapSelect'
11916+
},
11917+
link: function (scope, element, attrs, ngModel) {
11918+
var optionCollectionList, optionCollectionExpr, optionCollection, $render = ngModel.$render;
11919+
11920+
var selectpickerRefresh = function (argument) {
11921+
scope.$applyAsync(function () {
11922+
element.selectpicker('refresh');
11923+
});
11924+
};
11925+
11926+
var selectpickerDestroy = function () {
11927+
element.selectpicker('destroy');
11928+
};
11929+
11930+
element.selectpicker(scope.selectPickerOptions);
11931+
11932+
ngModel.$render = function () {
11933+
$render.apply(this, arguments);
11934+
selectpickerRefresh();
11935+
};
11936+
11937+
if (attrs.ngOptions) {
11938+
optionCollectionList = attrs.ngOptions.split('in ');
11939+
optionCollectionExpr = optionCollectionList[optionCollectionList.length - 1].split(/track by|\|/);
11940+
optionCollection = optionCollectionExpr[0];
11941+
11942+
scope.$parent.$watchCollection(optionCollection, selectpickerRefresh);
11943+
}
11944+
11945+
if (attrs.ngModel) {
11946+
scope.$parent.$watch(attrs.ngModel, selectpickerRefresh);
11947+
}
11948+
11949+
attrs.$observe('disabled', selectpickerRefresh);
11950+
11951+
scope.$on('$destroy', selectpickerDestroy);
11952+
}
11953+
};
11954+
});
11955+
;/**
11956+
* @ngdoc directive
11957+
* @name patternfly.select.directive:pfBootstrapSelect
11958+
* @element select
11959+
*
11960+
* @param {string} ngModel Model binding using the {@link https://docs.angularjs.org/api/ng/type/ngModel.NgModelController/ NgModelController} is mandatory.
11961+
* @param {string=} ngOptions The `{@link https://docs.angularjs.org/api/ng/directive/select/ ngOptions}` attribute can be used to dynamically generate a list of `<option>`
11962+
* elements for the `<select>` element.
11963+
*
11964+
* @description
11965+
* An AngularJS wrapper for the {@link http://silviomoreto.github.io/bootstrap-select/ Bootstrap-select} jQuery plugin which is used
11966+
* as a default select decorator in {@link https://www.patternfly.org/widgets/#bootstrap-select Patternfly}.
11967+
*
11968+
* @example
11969+
<example module="patternfly.select">
11970+
11971+
<file name="index.html">
11972+
<div ng-controller="SelectDemoCtrl">
11973+
11974+
<form class="form-horizontal">
11975+
<div class="form-group">
11976+
<label class="col-sm-2 control-label" for="pet">Preferred pet:</label>
11977+
<div class="col-sm-10">
11978+
<select pf-bootstrap-select ng-model="pet" id="pet" ng-options="o as o for o in pets"></select>
11979+
</div>
11980+
</div>
11981+
11982+
<div class="form-group">
11983+
<label class="col-sm-2 control-label" for="fruit">Preferred fruit:</label>
11984+
<div class="col-sm-10">
11985+
<select pf-bootstrap-select ng-model="fruit" id="fruit">
11986+
<option value="orange">Orange</option>
11987+
<option value="apple" ng-selected="true" selected>Apple</option>
11988+
<option value="banana">Banana</option>
11989+
</select>
11990+
</div>
11991+
</div>
11992+
11993+
<div class="form-group">
11994+
<label class="col-sm-2 control-label" for="drink">Preferred drink:</label>
11995+
<div class="col-sm-10">
11996+
<select pf-bootstrap-select="{ noneSelectedText: 'None' }" ng-model="drink" id="drink" ng-options="o as o for o in drinks">
11997+
<option value="">No drink selected</option>
11998+
</select>
11999+
</div>
12000+
</div>
12001+
12002+
</form>
12003+
12004+
<p>Your preferred pet is {{pet}}.</p>
12005+
<p>Your preferred fruit is {{fruit}}.</p>
12006+
<p>Your preferred drink is {{drink || 'No drink selected'}}.</p>
12007+
12008+
</div>
12009+
</file>
12010+
12011+
<file name="script.js">
12012+
angular.module( 'patternfly.select' ).controller( 'SelectDemoCtrl', function( $scope ) {
12013+
$scope.drinks = ['tea', 'coffee', 'water'];
12014+
$scope.pets = ['Dog', 'Cat', 'Chicken'];
12015+
$scope.pet = $scope.pets[0];
12016+
$scope.fruit = 'orange';
12017+
});
12018+
</file>
12019+
12020+
</example>
12021+
*/
1190812022
;/**
1190912023
* @ngdoc directive
1191012024
* @name patternfly.select.component:pfSelect
@@ -11917,7 +12031,7 @@ angular.module('patternfly.pagination').component('pfPagination', {
1191712031
* @param {function(item)} onSelect Function to call upon user selection of an item.
1191812032
*
1191912033
* @description
11920-
* The pfSelect component provides a wrapper for the angular ui bootstrap dropdown container allowing for use of ng-model and ng-options
12034+
* The pfSelect component provides a wrapper for the angular ui bootstrap dropdown.
1192112035
*
1192212036
* @example
1192312037
<example module="patternfly.select">
@@ -11944,7 +12058,7 @@ angular.module('patternfly.pagination').component('pfPagination', {
1194412058
</div>
1194512059
</form>
1194612060
<p>Your preferred pet is {{pet || noPet}}.</p>
11947-
<p>Your preferred drink is {{fruit.name}}.</p>
12061+
<p>Your preferred fruit is {{fruit.name}}.</p>
1194812062
<p>Your preferred drink is {{drink ? drink.name : noDrink}}.</p>
1194912063
</div>
1195012064
</file>

dist/angular-patternfly.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.

dist/docs/grunt-scripts/angular-patternfly.js

Lines changed: 116 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11905,6 +11905,120 @@ angular.module('patternfly.pagination').component('pfPagination', {
1190511905
}
1190611906
}]
1190711907
});
11908+
;angular.module('patternfly.select').directive('pfBootstrapSelect', function () {
11909+
'use strict';
11910+
11911+
return {
11912+
restrict: 'A',
11913+
require: '?ngModel',
11914+
scope: {
11915+
selectPickerOptions: '=pfBootstrapSelect'
11916+
},
11917+
link: function (scope, element, attrs, ngModel) {
11918+
var optionCollectionList, optionCollectionExpr, optionCollection, $render = ngModel.$render;
11919+
11920+
var selectpickerRefresh = function (argument) {
11921+
scope.$applyAsync(function () {
11922+
element.selectpicker('refresh');
11923+
});
11924+
};
11925+
11926+
var selectpickerDestroy = function () {
11927+
element.selectpicker('destroy');
11928+
};
11929+
11930+
element.selectpicker(scope.selectPickerOptions);
11931+
11932+
ngModel.$render = function () {
11933+
$render.apply(this, arguments);
11934+
selectpickerRefresh();
11935+
};
11936+
11937+
if (attrs.ngOptions) {
11938+
optionCollectionList = attrs.ngOptions.split('in ');
11939+
optionCollectionExpr = optionCollectionList[optionCollectionList.length - 1].split(/track by|\|/);
11940+
optionCollection = optionCollectionExpr[0];
11941+
11942+
scope.$parent.$watchCollection(optionCollection, selectpickerRefresh);
11943+
}
11944+
11945+
if (attrs.ngModel) {
11946+
scope.$parent.$watch(attrs.ngModel, selectpickerRefresh);
11947+
}
11948+
11949+
attrs.$observe('disabled', selectpickerRefresh);
11950+
11951+
scope.$on('$destroy', selectpickerDestroy);
11952+
}
11953+
};
11954+
});
11955+
;/**
11956+
* @ngdoc directive
11957+
* @name patternfly.select.directive:pfBootstrapSelect
11958+
* @element select
11959+
*
11960+
* @param {string} ngModel Model binding using the {@link https://docs.angularjs.org/api/ng/type/ngModel.NgModelController/ NgModelController} is mandatory.
11961+
* @param {string=} ngOptions The `{@link https://docs.angularjs.org/api/ng/directive/select/ ngOptions}` attribute can be used to dynamically generate a list of `<option>`
11962+
* elements for the `<select>` element.
11963+
*
11964+
* @description
11965+
* An AngularJS wrapper for the {@link http://silviomoreto.github.io/bootstrap-select/ Bootstrap-select} jQuery plugin which is used
11966+
* as a default select decorator in {@link https://www.patternfly.org/widgets/#bootstrap-select Patternfly}.
11967+
*
11968+
* @example
11969+
<example module="patternfly.select">
11970+
11971+
<file name="index.html">
11972+
<div ng-controller="SelectDemoCtrl">
11973+
11974+
<form class="form-horizontal">
11975+
<div class="form-group">
11976+
<label class="col-sm-2 control-label" for="pet">Preferred pet:</label>
11977+
<div class="col-sm-10">
11978+
<select pf-bootstrap-select ng-model="pet" id="pet" ng-options="o as o for o in pets"></select>
11979+
</div>
11980+
</div>
11981+
11982+
<div class="form-group">
11983+
<label class="col-sm-2 control-label" for="fruit">Preferred fruit:</label>
11984+
<div class="col-sm-10">
11985+
<select pf-bootstrap-select ng-model="fruit" id="fruit">
11986+
<option value="orange">Orange</option>
11987+
<option value="apple" ng-selected="true" selected>Apple</option>
11988+
<option value="banana">Banana</option>
11989+
</select>
11990+
</div>
11991+
</div>
11992+
11993+
<div class="form-group">
11994+
<label class="col-sm-2 control-label" for="drink">Preferred drink:</label>
11995+
<div class="col-sm-10">
11996+
<select pf-bootstrap-select="{ noneSelectedText: 'None' }" ng-model="drink" id="drink" ng-options="o as o for o in drinks">
11997+
<option value="">No drink selected</option>
11998+
</select>
11999+
</div>
12000+
</div>
12001+
12002+
</form>
12003+
12004+
<p>Your preferred pet is {{pet}}.</p>
12005+
<p>Your preferred fruit is {{fruit}}.</p>
12006+
<p>Your preferred drink is {{drink || 'No drink selected'}}.</p>
12007+
12008+
</div>
12009+
</file>
12010+
12011+
<file name="script.js">
12012+
angular.module( 'patternfly.select' ).controller( 'SelectDemoCtrl', function( $scope ) {
12013+
$scope.drinks = ['tea', 'coffee', 'water'];
12014+
$scope.pets = ['Dog', 'Cat', 'Chicken'];
12015+
$scope.pet = $scope.pets[0];
12016+
$scope.fruit = 'orange';
12017+
});
12018+
</file>
12019+
12020+
</example>
12021+
*/
1190812022
;/**
1190912023
* @ngdoc directive
1191012024
* @name patternfly.select.component:pfSelect
@@ -11917,7 +12031,7 @@ angular.module('patternfly.pagination').component('pfPagination', {
1191712031
* @param {function(item)} onSelect Function to call upon user selection of an item.
1191812032
*
1191912033
* @description
11920-
* The pfSelect component provides a wrapper for the angular ui bootstrap dropdown container allowing for use of ng-model and ng-options
12034+
* The pfSelect component provides a wrapper for the angular ui bootstrap dropdown.
1192112035
*
1192212036
* @example
1192312037
<example module="patternfly.select">
@@ -11944,7 +12058,7 @@ angular.module('patternfly.pagination').component('pfPagination', {
1194412058
</div>
1194512059
</form>
1194612060
<p>Your preferred pet is {{pet || noPet}}.</p>
11947-
<p>Your preferred drink is {{fruit.name}}.</p>
12061+
<p>Your preferred fruit is {{fruit.name}}.</p>
1194812062
<p>Your preferred drink is {{drink ? drink.name : noDrink}}.</p>
1194912063
</div>
1195012064
</file>

0 commit comments

Comments
 (0)