Skip to content

Commit 07d1d22

Browse files
Merge branch 'master-local' into master-dist
2 parents 34889cb + ebed844 commit 07d1d22

File tree

61 files changed

+235
-148
lines changed

Some content is hidden

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

61 files changed

+235
-148
lines changed

dist/angular-patternfly.js

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11892,7 +11892,8 @@ angular.module('patternfly.pagination').component('pfPagination', {
1189211892
* <ul style='list-style-type: none'>
1189311893
* <li>.header - (string) Text label for a column header
1189411894
* <li>.itemField - (string) Item field to associate with a particular column.
11895-
* <li>.htmlTemplate - (string) (optional) id/name of an embedded ng/html template. Ex: htmlTemplate="name_template.html". The template will be used to render each cell of the column.
11895+
* <li>.templateFn - (function) (optional) Template function used to render each cell of the column. Pro: more performant than `htmlTemplate`. Con: doesn't support AngularJS directives in the template, therefore it doesn't support things like ng-click. Example: <pre>templateFn: value => `<span class="text-danger">${value}</span>`</pre>
11896+
* <li>.htmlTemplate - (string) (optional) id/name of an embedded ng/html template. Pro: supports AngularJS directives in the template. Con: poor performance on large tables. Ex: htmlTemplate="name_template.html". The template will be used to render each cell of the column.
1189611897
* Use <code>handleColAction(key, value)</code> in the template to call the <code>colActionFn</code> callback function you specify. 'key' is the item attribute name; which should equal the itemFld of a column.
1189711898
* 'value' is the item[key] value.
1189811899
* <pre>
@@ -11903,6 +11904,7 @@ angular.module('patternfly.pagination').component('pfPagination', {
1190311904
* <li>.colActionFn - (function) (optional) Callback function used for the column. 'value' is passed as a paramenter to the
1190411905
* callback function.
1190511906
* </ul>
11907+
* <p><strong>Tip:</strong> For templating, use `tempateFn` unless you really need to use AngularJS directives. `templateFn` performs better than `htmlTemplate`.</p>
1190611908
* @param {array} actionButtons List of action buttons in each row
1190711909
* <ul style='list-style-type: none'>
1190811910
* <li>.name - (String) The name of the action, displayed on the button
@@ -11980,7 +11982,7 @@ angular.module('patternfly.pagination').component('pfPagination', {
1198011982
{ header: "Status", itemField: "status", htmlTemplate: "status_template.html" },
1198111983
{ header: "Name", itemField: "name", htmlTemplate: "name_template.html", colActionFn: onNameClick },
1198211984
{ header: "Address", itemField: "address"},
11983-
{ header: "City", itemField: "city" },
11985+
{ header: "City", itemField: "city", templateFn: function(value) { return '<span class="text-success">' + value + '</span>' } },
1198411986
{ header: "State", itemField: "state"}
1198511987
];
1198611988

@@ -12238,7 +12240,8 @@ angular.module('patternfly.pagination').component('pfPagination', {
1223812240
* <ul style='list-style-type: none'>
1223912241
* <li>.header - (string) Text label for a column header
1224012242
* <li>.itemField - (string) Item field to associate with a particular column.
12241-
* <li>.htmlTemplate - (string) (optional) id/name of an embedded ng/html template. Ex: htmlTemplate="name_template.html". The template will be used to render each cell of the column.
12243+
* <li>.templateFn - (function) (optional) Template function used to render each cell of the column. Pro: more performant than `htmlTemplate`. Con: doesn't support AngularJS directives in the template, therefore it doesn't support things like ng-click. Example: <pre>templateFn: value => `<span class="text-danger">${value}</span>`</pre>
12244+
* <li>.htmlTemplate - (string) (optional) id/name of an embedded ng/html template. Pro: supports AngularJS directives in the template. Con: poor performance on large tables. Ex: htmlTemplate="name_template.html". The template will be used to render each cell of the column.
1224212245
* Use <code>handleColAction(key, value)</code> in the template to call the <code>colActionFn</code> callback function you specify. 'key' is the item attribute name; which should equal the itemFld of a column.
1224312246
* 'value' is the item[key] value.
1224412247
* <pre>
@@ -12249,6 +12252,7 @@ angular.module('patternfly.pagination').component('pfPagination', {
1224912252
* <li>.colActionFn - (function) (optional) Callback function used for the column. 'value' is passed as a paramenter to the
1225012253
* callback function.
1225112254
* </ul>
12255+
* <p><strong>Tip:</strong> For templating, use `tempateFn` unless you really need to use AngularJS directives. `templateFn` performs better than `htmlTemplate`.</p>
1225212256
* @param {array} actionButtons List of action buttons in each row
1225312257
* <ul style='list-style-type: none'>
1225412258
* <li>.name - (String) The name of the action, displayed on the button
@@ -12364,11 +12368,34 @@ angular.module('patternfly.pagination').component('pfPagination', {
1236412368
$scope.actionsText = "";
1236512369

1236612370
$scope.columns = [
12367-
{ header: "Status", itemField: "status", htmlTemplate: "status_template.html" },
12368-
{ header: "Name", itemField: "name", htmlTemplate: "name_template.html", colActionFn: onNameClick },
12369-
{ header: "Age", itemField: "age"},
12370-
{ header: "Address", itemField: "address", htmlTemplate: "address_template.html" },
12371-
{ header: "BirthMonth", itemField: "birthMonth"}
12371+
{
12372+
header: "Status",
12373+
itemField: "status",
12374+
htmlTemplate: "status_template.html"
12375+
},
12376+
{
12377+
header: "Name",
12378+
itemField: "name",
12379+
htmlTemplate: "name_template.html",
12380+
colActionFn: onNameClick
12381+
},
12382+
{
12383+
header: "Age",
12384+
itemField: "age",
12385+
templateFn: function(value) {
12386+
var className = value > 30 ? 'text-success' : 'text-warning';
12387+
return '<span class="' + className + '">' + value + '</span>';
12388+
}
12389+
},
12390+
{
12391+
header: "Address",
12392+
itemField: "address",
12393+
htmlTemplate: "address_template.html"
12394+
},
12395+
{
12396+
header: "BirthMonth",
12397+
itemField: "birthMonth"
12398+
}
1237212399
];
1237312400

1237412401
// dtOptions paginationType, displayLength, and dom:"p" are no longer being
@@ -12790,7 +12817,7 @@ angular.module('patternfly.pagination').component('pfPagination', {
1279012817
emptyStateActionButtons: '=?'
1279112818
},
1279212819
templateUrl: 'table/tableview/table-view.html',
12793-
controller: ["DTOptionsBuilder", "DTColumnDefBuilder", "$element", "pfUtils", "$log", "$filter", "$timeout", function (DTOptionsBuilder, DTColumnDefBuilder, $element, pfUtils, $log, $filter, $timeout) {
12820+
controller: ["DTOptionsBuilder", "DTColumnDefBuilder", "$element", "pfUtils", "$log", "$filter", "$timeout", "$sce", function (DTOptionsBuilder, DTColumnDefBuilder, $element, pfUtils, $log, $filter, $timeout, $sce) {
1279412821
'use strict';
1279512822
var ctrl = this, prevDtOptions, prevItems;
1279612823

@@ -13174,21 +13201,6 @@ angular.module('patternfly.pagination').component('pfPagination', {
1317413201
}
1317513202
};
1317613203

13177-
ctrl.hasHTMLTemplate = function (key) {
13178-
var htmlTemplate = this.getHTMLTemplate(key);
13179-
return htmlTemplate.length > 0;
13180-
};
13181-
13182-
ctrl.getHTMLTemplate = function (key) {
13183-
var retVal = '';
13184-
var tableCol = $filter('filter')(ctrl.columns, {itemField: key});
13185-
13186-
if (tableCol && tableCol.length === 1 && tableCol[0].hasOwnProperty('htmlTemplate')) {
13187-
retVal = tableCol[0].htmlTemplate;
13188-
}
13189-
return retVal;
13190-
};
13191-
1319213204
ctrl.handleColAction = function (key, value) {
1319313205
var tableCol = $filter('filter')(ctrl.columns, {itemField: key});
1319413206

@@ -13267,6 +13279,10 @@ angular.module('patternfly.pagination').component('pfPagination', {
1326713279
ctrl.dropdownClass = 'dropup';
1326813280
}
1326913281
}
13282+
13283+
ctrl.trustAsHtml = function (html) {
13284+
return $sce.trustAsHtml(html);
13285+
};
1327013286
}]
1327113287
});
1327213288
;/**
@@ -17584,7 +17600,7 @@ angular.module('patternfly.wizard').component('pfWizard', {
1758417600
'use strict';
1758517601

1758617602
$templateCache.put('table/tableview/table-view.html',
17587-
"<div class=container-fluid><table ng-if=\"$ctrl.config.itemsAvailable !== false\" datatable=ng dt-options=$ctrl.dtOptions dt-column-defs=$ctrl.dtColumnDefs dt-instance=$ctrl.dtInstanceCallback class=\"table-view-container table table-striped table-bordered table-hover dataTable\"><thead><tr role=row><th class=table-view-pf-select ng-if=$ctrl.config.showCheckboxes><input type=checkbox value=$ctrl.selectAll ng-model=$ctrl.selectAll ng-change=\"$ctrl.toggleAll()\"></th><th ng-repeat=\"col in $ctrl.columns\">{{col.header}}</th><th ng-if=$ctrl.areActions() colspan={{$ctrl.calcActionsColspan()}}>Actions</th></tr></thead><tbody><tr role=row ng-repeat=\"item in $ctrl.items track by $index\"><td class=table-view-pf-select ng-if=$ctrl.config.showCheckboxes><input type=checkbox value=item.selected ng-model=item.selected ng-change=\"$ctrl.toggleOne(item)\"></td><td ng-repeat=\"col in $ctrl.columns\" ng-init=\"key = col.itemField; value = item[key]\"><span ng-if=!$ctrl.hasHTMLTemplate(key)>{{value}}</span> <span ng-if=$ctrl.hasHTMLTemplate(key) ng-include=$ctrl.getHTMLTemplate(key)></span></td><td ng-if=\"$ctrl.actionButtons && $ctrl.actionButtons.length > 0\" class=table-view-pf-actions ng-repeat=\"actionButton in $ctrl.actionButtons\"><div class=table-view-pf-btn><button class=\"btn btn-default\" title={{actionButton.title}} ng-click=\"$ctrl.handleButtonAction(actionButton, item)\"><span ng-if=!actionButton.include>{{actionButton.name}}</span></button></div></td><td ng-if=\"$ctrl.menuActions && $ctrl.menuActions.length > 0\" class=\"table-view-pf-actions list-group-item-header\"><div uib-dropdown class=\"{{$ctrl.dropdownClass}} dropdown-kebab-pf\" id=kebab_{{$index}} ng-if=\"$ctrl.menuActions && $ctrl.menuActions.length > 0\"><button uib-dropdown-toggle class=\"btn btn-default dropdown-toggle\" type=button id=dropdownKebabRight_{{$index}} ng-click=\"$ctrl.setupActions(item, $event)\"><span class=\"fa fa-ellipsis-v\"></span></button><ul uib-dropdown-menu class=\"dropdown-menu dropdown-menu-right {{$index}}\" aria-labelledby=dropdownKebabRight_{{$index}}><li ng-repeat=\"menuAction in $ctrl.menuActions\" ng-if=\"menuAction.isVisible !== false\" role=\"{{menuAction.isSeparator === true ? 'separator' : 'menuitem'}}\" ng-class=\"{'divider': (menuAction.isSeparator === true), 'disabled': (menuAction.isDisabled === true)}\"><a ng-if=\"menuAction.isSeparator !== true\" title={{menuAction.title}} ng-click=\"$ctrl.handleMenuAction(menuAction, item)\">{{menuAction.name}}</a></li></ul></div></td></tr></tbody></table><pf-pagination ng-if=\"$ctrl.dtOptions.paging && $ctrl.config.itemsAvailable === true\" page-size=$ctrl.pageConfig.pageSize page-number=$ctrl.pageConfig.pageNumber num-total-items=$ctrl.pageConfig.numTotalItems page-size-increments=$ctrl.pageConfig.pageSizeIncrements update-page-size=$ctrl.updatePageSize($event) update-page-number=$ctrl.updatePageNumber($event)></pf-pagination><pf-empty-state ng-if=\"$ctrl.config.itemsAvailable === false\" config=$ctrl.emptyStateConfig action-buttons=$ctrl.emptyStateActionButtons></pf-empty-state></div>"
17603+
"<div class=container-fluid><table ng-if=\"$ctrl.config.itemsAvailable !== false\" datatable=ng dt-options=$ctrl.dtOptions dt-column-defs=$ctrl.dtColumnDefs dt-instance=$ctrl.dtInstanceCallback class=\"table-view-container table table-striped table-bordered table-hover dataTable\"><thead><tr role=row><th class=table-view-pf-select ng-if=$ctrl.config.showCheckboxes><input type=checkbox value=$ctrl.selectAll ng-model=$ctrl.selectAll ng-change=\"$ctrl.toggleAll()\"></th><th ng-repeat=\"col in $ctrl.columns\">{{col.header}}</th><th ng-if=$ctrl.areActions() colspan={{$ctrl.calcActionsColspan()}}>Actions</th></tr></thead><tbody><tr role=row ng-repeat=\"item in $ctrl.items track by $index\"><td class=table-view-pf-select ng-if=$ctrl.config.showCheckboxes><input type=checkbox value=item.selected ng-model=item.selected ng-change=\"$ctrl.toggleOne(item)\"></td><td ng-repeat=\"col in $ctrl.columns\" ng-init=\"key = col.itemField; value = item[key]\"><span ng-if=\"!col.htmlTemplate && !col.templateFn\">{{value}}</span> <span ng-if=col.htmlTemplate ng-include=col.htmlTemplate></span> <span ng-if=col.templateFn ng-bind-html=$ctrl.trustAsHtml(col.templateFn(value))></span></td><td ng-if=\"$ctrl.actionButtons && $ctrl.actionButtons.length > 0\" class=table-view-pf-actions ng-repeat=\"actionButton in $ctrl.actionButtons\"><div class=table-view-pf-btn><button class=\"btn btn-default\" title={{actionButton.title}} ng-click=\"$ctrl.handleButtonAction(actionButton, item)\"><span ng-if=!actionButton.include>{{actionButton.name}}</span></button></div></td><td ng-if=\"$ctrl.menuActions && $ctrl.menuActions.length > 0\" class=\"table-view-pf-actions list-group-item-header\"><div uib-dropdown class=\"{{$ctrl.dropdownClass}} dropdown-kebab-pf\" id=kebab_{{$index}} ng-if=\"$ctrl.menuActions && $ctrl.menuActions.length > 0\"><button uib-dropdown-toggle class=\"btn btn-default dropdown-toggle\" type=button id=dropdownKebabRight_{{$index}} ng-click=\"$ctrl.setupActions(item, $event)\"><span class=\"fa fa-ellipsis-v\"></span></button><ul uib-dropdown-menu class=\"dropdown-menu dropdown-menu-right {{$index}}\" aria-labelledby=dropdownKebabRight_{{$index}}><li ng-repeat=\"menuAction in $ctrl.menuActions\" ng-if=\"menuAction.isVisible !== false\" role=\"{{menuAction.isSeparator === true ? 'separator' : 'menuitem'}}\" ng-class=\"{'divider': (menuAction.isSeparator === true), 'disabled': (menuAction.isDisabled === true)}\"><a ng-if=\"menuAction.isSeparator !== true\" title={{menuAction.title}} ng-click=\"$ctrl.handleMenuAction(menuAction, item)\">{{menuAction.name}}</a></li></ul></div></td></tr></tbody></table><pf-pagination ng-if=\"$ctrl.dtOptions.paging && $ctrl.config.itemsAvailable === true\" page-size=$ctrl.pageConfig.pageSize page-number=$ctrl.pageConfig.pageNumber num-total-items=$ctrl.pageConfig.numTotalItems page-size-increments=$ctrl.pageConfig.pageSizeIncrements update-page-size=$ctrl.updatePageSize($event) update-page-number=$ctrl.updatePageNumber($event)></pf-pagination><pf-empty-state ng-if=\"$ctrl.config.itemsAvailable === false\" config=$ctrl.emptyStateConfig action-buttons=$ctrl.emptyStateActionButtons></pf-empty-state></div>"
1758817604
);
1758917605

1759017606
}]);

dist/angular-patternfly.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)