Skip to content

Commit

Permalink
Merge pull request #100 from uptick/export-filters-only
Browse files Browse the repository at this point in the history
export and accept version where only filters are applied
  • Loading branch information
SeanThompsonUptick authored Jun 30, 2020
2 parents 43927b2 + 0020108 commit 3d2b33c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-object-list",
"version": "0.2.9",
"version": "0.2.10",
"description": "React component to display an array of object data in a filterable view",
"repository": {
"url": "https://github.com/uptick/react-object-list",
Expand Down
19 changes: 12 additions & 7 deletions src/actions-filters/ActionsFiltersContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class ActionsFilterContainer extends Component {
icons: PropTypes.object,
/** Object of custom react-select styles */
selectStyles: PropTypes.object,
/** Show item count if we are using data **/
showItemCount: PropTypes.bool,
}

static defaultProps = {
Expand All @@ -81,6 +83,7 @@ class ActionsFilterContainer extends Component {
columns: [],
status: STATUS_CHOICES.done,
selectStyles: {},
showItemCount: true,
}

state = {
Expand Down Expand Up @@ -110,7 +113,7 @@ class ActionsFilterContainer extends Component {
filters, updateFilter, removeFilter, status,
updateColumns, loadFavourite, handleAddFavourite,
selectedFavouriteName, handleDeleteFavourite, favourites,
selectStyles,
selectStyles, showItemCount,
} = this.props
const loading = status === STATUS_CHOICES.loading
let search
Expand Down Expand Up @@ -141,7 +144,7 @@ class ActionsFilterContainer extends Component {
<SelectFilters
filters={filters.filter(f =>
(!search || f.filterKey !== searchKey) && // remove search filter
((f.permanent !== undefined && !f.permanent) || (f.permanent === undefined && !f.Renderer.defaultProps.permanent)) // remove filters to display permanently
((f.permanent !== undefined && !f.permanent) || (f.permanent === undefined && (!f.Renderer || !f.Renderer.defaultProps.permanent))) // remove filters to display permanently
)}
addFilter={this.props.addFilter}
selectStyles={selectStyles}
Expand Down Expand Up @@ -170,11 +173,13 @@ class ActionsFilterContainer extends Component {
{/* TODO: render children below filters */}
<div className="objectlist-row objectlist-row__actions">
<div className="objectlist-column">
<span className="objectlist-results-text">
{loading ? `Loading ${itemPluralName}...` : (
`${totalCount ? totalCount.toLocaleString() : 'No'} ${totalCount === 1 ? itemSingleName : itemPluralName} found`
)}
</span>
{showItemCount && (
<span className="objectlist-results-text">
{loading ? `Loading ${itemPluralName}...` : (
`${totalCount ? totalCount.toLocaleString() : 'No'} ${totalCount === 1 ? itemSingleName : itemPluralName} found`
)}
</span>
)}
{customActions[0] && customActions[0]({
selection,
itemCount,
Expand Down
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import ObjectList from './ObjectList'
export {COLUMN_TYPE} from './ObjectList'
import ActionsFilterContainer from './actions-filters/ActionsFiltersContainer'
export { COLUMN_TYPE } from './ObjectList'
export { FILTER_BASE_TYPE, META_TYPE, STATUS_TYPE, STATUS_CHOICES, SELECTION_TYPE } from './utils/proptypes'
export default ObjectList

const FilterContainer = ActionsFilterContainer
export { FilterContainer }

0 comments on commit 3d2b33c

Please sign in to comment.