@@ -18,14 +18,16 @@ import styles from 'components/BrowserFilter/BrowserFilter.scss';
1818import { List , Map } from 'immutable' ;
1919
2020const BLACKLISTED_FILTERS = [ 'containsAny' , 'doesNotContainAny' ] ;
21+ const POPOVER_CONTENT_ID = 'browserFilterPopover' ;
2122
2223export default class BrowserFilter extends React . Component {
23- constructor ( ) {
24- super ( ) ;
24+ constructor ( props ) {
25+ super ( props ) ;
2526
2627 this . state = {
2728 open : false ,
2829 filters : new List ( ) ,
30+ blacklistedFilters : BLACKLISTED_FILTERS . concat ( props . blacklistedFilters )
2931 } ;
3032 this . toggle = this . toggle . bind ( this )
3133 }
@@ -43,7 +45,7 @@ export default class BrowserFilter extends React.Component {
4345 toggle ( ) {
4446 let filters = this . props . filters ;
4547 if ( this . props . filters . size === 0 ) {
46- let available = Filters . availableFilters ( this . props . schema , null , BLACKLISTED_FILTERS ) ;
48+ let available = Filters . availableFilters ( this . props . schema , null , this . state . blacklistedFilters ) ;
4749 let field = Object . keys ( available ) [ 0 ] ;
4850 filters = new List ( [ new Map ( { field : field , constraint : available [ field ] [ 0 ] } ) ] ) ;
4951 }
@@ -55,7 +57,7 @@ export default class BrowserFilter extends React.Component {
5557 }
5658
5759 addRow ( ) {
58- let available = Filters . availableFilters ( this . props . schema , this . state . filters , BLACKLISTED_FILTERS ) ;
60+ let available = Filters . availableFilters ( this . props . schema , this . state . filters , this . state . blacklistedFilters ) ;
5961 let field = Object . keys ( available ) [ 0 ] ;
6062 this . setState ( ( { filters } ) => ( {
6163 filters : filters . push ( new Map ( { field : field , constraint : available [ field ] [ 0 ] } ) ) ,
@@ -92,12 +94,12 @@ export default class BrowserFilter extends React.Component {
9294 }
9395 let available = Filters . availableFilters ( this . props . schema , this . state . filters ) ;
9496 popover = (
95- < Popover fixed = { true } position = { position } onExternalClick = { this . toggle } >
96- < div className = { popoverStyle . join ( ' ' ) } onClick = { ( ) => this . props . setCurrent ( null ) } >
97+ < Popover fixed = { true } position = { position } onExternalClick = { this . toggle } contentId = { POPOVER_CONTENT_ID } >
98+ < div className = { popoverStyle . join ( ' ' ) } onClick = { ( ) => this . props . setCurrent ( null ) } id = { POPOVER_CONTENT_ID } >
9799 < div onClick = { this . toggle } style = { { cursor : 'pointer' , width : this . node . clientWidth , height : this . node . clientHeight } } > </ div >
98100 < div className = { styles . body } >
99101 < Filter
100- blacklist = { BLACKLISTED_FILTERS }
102+ blacklist = { this . state . blacklistedFilters }
101103 schema = { this . props . schema }
102104 filters = { this . state . filters }
103105 onChange = { ( filters ) => this . setState ( { filters : filters } ) }
0 commit comments