updateFilter
This commit is contained in:
parent
7b11e40981
commit
4cd803466a
|
@ -172,10 +172,10 @@ class DateFilter extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onRuleChange( value ) {
|
onRuleChange( value ) {
|
||||||
const { onFilterChange, filter, replaceFilter } = this.props;
|
const { onFilterChange, filter, updateFilter } = this.props;
|
||||||
const { before } = this.state;
|
const { before } = this.state;
|
||||||
if ( 'between' === filter.rule && 'between' !== value ) {
|
if ( 'between' === filter.rule && 'between' !== value ) {
|
||||||
replaceFilter( {
|
updateFilter( {
|
||||||
key: filter.key,
|
key: filter.key,
|
||||||
rule: value,
|
rule: value,
|
||||||
value: before ? before.format( isoDateFormat ) : undefined,
|
value: before ? before.format( isoDateFormat ) : undefined,
|
||||||
|
|
|
@ -55,7 +55,7 @@ class AdvancedFilters extends Component {
|
||||||
this.removeFilter = this.removeFilter.bind( this );
|
this.removeFilter = this.removeFilter.bind( this );
|
||||||
this.clearFilters = this.clearFilters.bind( this );
|
this.clearFilters = this.clearFilters.bind( this );
|
||||||
this.getUpdateHref = this.getUpdateHref.bind( this );
|
this.getUpdateHref = this.getUpdateHref.bind( this );
|
||||||
this.replaceFilter = this.replaceFilter.bind( this );
|
this.updateFilter = this.updateFilter.bind( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate( prevProps ) {
|
componentDidUpdate( prevProps ) {
|
||||||
|
@ -86,7 +86,7 @@ class AdvancedFilters extends Component {
|
||||||
this.setState( { activeFilters } );
|
this.setState( { activeFilters } );
|
||||||
}
|
}
|
||||||
|
|
||||||
replaceFilter( filter ) {
|
updateFilter( filter ) {
|
||||||
const activeFilters = this.state.activeFilters.map( activeFilter => {
|
const activeFilters = this.state.activeFilters.map( activeFilter => {
|
||||||
if ( filter.key === activeFilter.key ) {
|
if ( filter.key === activeFilter.key ) {
|
||||||
return filter;
|
return filter;
|
||||||
|
@ -230,7 +230,7 @@ class AdvancedFilters extends Component {
|
||||||
onFilterChange={ this.onFilterChange }
|
onFilterChange={ this.onFilterChange }
|
||||||
isEnglish={ isEnglish }
|
isEnglish={ isEnglish }
|
||||||
query={ query }
|
query={ query }
|
||||||
replaceFilter={ this.replaceFilter }
|
updateFilter={ this.updateFilter }
|
||||||
/>
|
/>
|
||||||
) }
|
) }
|
||||||
<IconButton
|
<IconButton
|
||||||
|
|
Loading…
Reference in New Issue