From a1c44d978e0a634565257356896f5a429d288128 Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Date: Tue, 29 Aug 2017 07:47:30 -0400 Subject: [PATCH] feat(pfFilter): Add filter options - inline, results count, items label Provides options to: display filter and result on a single line show the total count in the results label (i.e. 5 of 10 Results) change the label from Results to a passed in string --- src/filters/examples/filter.js | 27 +++++++++- src/filters/filters.less | 50 +++++++++++++++++ src/filters/simple-filter/filter-fields.html | 2 +- .../simple-filter/filter-results-component.js | 8 ++- src/filters/simple-filter/filter-results.html | 11 +++- src/filters/simple-filter/filter.html | 2 +- test/filters/filter.spec.js | 54 +++++++++++++++++++ 7 files changed, 148 insertions(+), 6 deletions(-) diff --git a/src/filters/examples/filter.js b/src/filters/examples/filter.js index aca2a8cf3..35e50a18b 100644 --- a/src/filters/examples/filter.js +++ b/src/filters/examples/filter.js @@ -21,8 +21,13 @@ *
  • .filterCategoriesPlaceholder - (String) Text to display in `complex-select` category value select when no filter value has been entered, Optional *
  • .filterDelimiter - (String) Delimiter separating 'complex-select' category and value. Optional, default is a space, ' ' * + *
  • .inlineResults - (Boolean) Flag to show results inline with the filter selection (default: false) *
  • .appliedFilters - (Array) List of the currently applied filters *
  • .resultsCount - (int) The number of results returned after the current applied filters have been applied + *
  • .totalCount - (int) The total number of items before any filters have been applied. The 'm' in the label: 'n' of 'm' selected + *
  • .showTotalCountResults - (Boolean) Optional, flag to show the total count in the filter results as well (ie. 'n' of 'm' Results) + *
  • .itemsLabel - (String) Optional label to use for the items in the results count (default: Result) + *
  • .itemsLabelPlural - (String) Optional label to use for the items in the resuults count when plural (default: Results) *
  • .onFilterChange - ( function(array of filters) ) Function to call when the applied filters list changes * * @@ -34,6 +39,26 @@
    +

    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    @@ -55,7 +80,6 @@ -

    @@ -206,6 +230,7 @@ } ], resultsCount: $scope.items.length, + totalCount: $scope.allItems.length, appliedFilters: [], onFilterChange: filterChange }; diff --git a/src/filters/filters.less b/src/filters/filters.less index e0d34a7ac..3b746b8c5 100644 --- a/src/filters/filters.less +++ b/src/filters/filters.less @@ -98,3 +98,53 @@ pf-filter-panel { padding-left: 4px; } } + +.filter-pf { + &.inline-filter-pf { + flex: 1 1 100%; + margin: 15px 15px 7px 0; + + pf-filter-fields, + pf-filter-results { + display: inline-block; + } + + .form-group { + margin-bottom: 0; + margin-right: 15px; + } + + .toolbar-pf-results { + border-top: none; + margin: 0; + + .col-sm-12 { + float: left; + padding: 0; + } + + h5, + p, + ul { + line-height: 1.43; + padding-bottom: 6px; + padding-top: 6px; + } + + .list-inline { + margin-bottom: -5px; + padding-right: 5px; + + > li { + margin-bottom: 5px; + } + } + } + } + + .toolbar-pf-results { + .list-inline { + margin-left: 0; + } + } +} diff --git a/src/filters/simple-filter/filter-fields.html b/src/filters/simple-filter/filter-fields.html index 7e9dd9860..5595b05d7 100644 --- a/src/filters/simple-filter/filter-fields.html +++ b/src/filters/simple-filter/filter-fields.html @@ -1,7 +1,7 @@
    -