Hide date range filter if dateRangeFilter.show is false
This commit is contained in:
parent
d161732c0a
commit
44e97caeab
|
@ -57,13 +57,15 @@ class ReportFilters extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { filters, query, path } = this.props;
|
const { dateRangeFilter, filters, query, path } = this.props;
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<H className="screen-reader-text">{ __( 'Filters', 'wc-admin' ) }</H>
|
<H className="screen-reader-text">{ __( 'Filters', 'wc-admin' ) }</H>
|
||||||
<Section component="div" className="woocommerce-filters">
|
<Section component="div" className="woocommerce-filters">
|
||||||
<div className="woocommerce-filters__basic-filters">
|
<div className="woocommerce-filters__basic-filters">
|
||||||
<DatePicker key={ JSON.stringify( query ) } query={ query } path={ path } />
|
{ dateRangeFilter.show && (
|
||||||
|
<DatePicker key={ JSON.stringify( query ) } query={ query } path={ path } />
|
||||||
|
) }
|
||||||
{ filters.map( config => {
|
{ filters.map( config => {
|
||||||
if ( config.showFilters( query ) ) {
|
if ( config.showFilters( query ) ) {
|
||||||
return (
|
return (
|
||||||
|
@ -89,6 +91,15 @@ ReportFilters.propTypes = {
|
||||||
* Config option passed through to `AdvancedFilters`
|
* Config option passed through to `AdvancedFilters`
|
||||||
*/
|
*/
|
||||||
advancedFilters: PropTypes.object,
|
advancedFilters: PropTypes.object,
|
||||||
|
/**
|
||||||
|
* Config options for the date range picker.
|
||||||
|
*/
|
||||||
|
dateRangeFilter: PropTypes.shape( {
|
||||||
|
/**
|
||||||
|
* Whether the date range filter must be shown.
|
||||||
|
*/
|
||||||
|
show: PropTypes.bool,
|
||||||
|
} ),
|
||||||
/**
|
/**
|
||||||
* Config option passed through to `FilterPicker` - if not used, `FilterPicker` is not displayed.
|
* Config option passed through to `FilterPicker` - if not used, `FilterPicker` is not displayed.
|
||||||
*/
|
*/
|
||||||
|
@ -105,6 +116,9 @@ ReportFilters.propTypes = {
|
||||||
|
|
||||||
ReportFilters.defaultProps = {
|
ReportFilters.defaultProps = {
|
||||||
advancedFilters: {},
|
advancedFilters: {},
|
||||||
|
dateRangeFilter: {
|
||||||
|
show: true,
|
||||||
|
},
|
||||||
filters: [],
|
filters: [],
|
||||||
query: {},
|
query: {},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue