Skip to content

Commit f90a590

Browse files
Add restrict E to ng-docs, enforce single select on toolbar filtering.
1 parent de304a7 commit f90a590

File tree

6 files changed

+12
-0
lines changed

6 files changed

+12
-0
lines changed

Diff for: src/filters/examples/filter.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* @ngdoc directive
33
* @name patternfly.filters.component:pfFilter
4+
* @restrict E
45
*
56
* @description
67
* Component for a filter bar

Diff for: src/filters/filter-fields-component.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* @ngdoc directive
33
* @name patternfly.filters.component:pfFilterFields
4+
* @restrict E
45
*
56
* @description
67
* Directive for the filter bar's filter entry components

Diff for: src/filters/filter-results-component.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* @ngdoc directive
33
* @name patternfly.filters.component:pfFilterResults
4+
* @restrict E
45
*
56
* @description
67
* Component for the filter results

Diff for: src/sort/examples/sort.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* @ngdoc directive
33
* @name patternfly.sort.component:pfSort
4+
* @restrict E
45
*
56
* @description
67
* Sort component

Diff for: src/toolbars/examples/toolbar.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* @ngdoc directive
33
* @name patternfly.toolbars.componenet:pfToolbar
4+
* @restrict E
45
*
56
* @description
67
* Standard toolbar component. Includes filtering and view selection capabilities

Diff for: src/toolbars/toolbar-component.js

+7
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,20 @@ angular.module('patternfly.toolbars').component('pfToolbar', {
5353
return foundFilter !== undefined;
5454
}
5555

56+
function enforceSingleSelect (filter) {
57+
_.remove(ctrl.config.appliedFilters, {title: filter.title});
58+
}
59+
5660
function addFilter (field, value) {
5761
var newFilter = {
5862
id: field.id,
5963
title: field.title,
6064
value: value
6165
};
6266
if (!filterExists(newFilter)) {
67+
if (newFilter.type === 'select') {
68+
enforceSingleSelect(newFilter);
69+
}
6370
ctrl.config.filterConfig.appliedFilters.push(newFilter);
6471

6572
if (ctrl.config.filterConfig.onFilterChange) {

0 commit comments

Comments
 (0)