8
8
import * as Filters from 'lib/Filters' ;
9
9
import { List , Map } from 'immutable' ;
10
10
import PropTypes from 'lib/PropTypes' ;
11
- import React from 'react' ;
11
+ import React , { useState } from 'react' ;
12
12
import stringCompare from 'lib/stringCompare' ;
13
13
import { CurrentApp } from 'context/currentApp' ;
14
14
@@ -61,7 +61,7 @@ function changeConstraint(schema, currentClassName, filters, index, newConstrain
61
61
class : currentClassName ,
62
62
field : field ,
63
63
constraint : newConstraint ,
64
- compareTo : prevCompareTo ?? Filters . DefaultComparisons [ compareType ] ,
64
+ compareTo : Filters . DefaultComparisons [ compareType ] ,
65
65
} ) ;
66
66
return filters . set ( index , newFilter ) ;
67
67
}
@@ -85,6 +85,12 @@ const Filter = ({
85
85
blacklist,
86
86
className,
87
87
} ) => {
88
+ const [ compare , setCompare ] = useState ( false ) ;
89
+ const hasCompareTo = filters . some ( filter => filter . get ( 'compareTo' ) !== undefined ) ;
90
+
91
+ if ( compare !== hasCompareTo ) {
92
+ setCompare ( hasCompareTo ) ;
93
+ }
88
94
const currentApp = React . useContext ( CurrentApp ) ;
89
95
blacklist = blacklist || [ ] ;
90
96
const available = Filters . findRelatedClasses ( className , allClasses , blacklist , filters ) ;
@@ -96,6 +102,22 @@ const Filter = ({
96
102
overflowY : 'auto' ,
97
103
} }
98
104
>
105
+ < div
106
+ style = { {
107
+ display : 'flex' ,
108
+ gap : '10px' ,
109
+ padding : '12px 15px 0px 15px' ,
110
+ color : '#343445' ,
111
+ 'font-weight' : '600'
112
+ } }
113
+ >
114
+ < div style = { { width : '140px' } } > Class</ div >
115
+ < div style = { { width : '140px' } } > Field</ div >
116
+ < div style = { { width : '175px' } } > Condition</ div >
117
+ { compare && < div > Value</ div > }
118
+ < div > </ div >
119
+ </ div >
120
+
99
121
{ filters . toArray ( ) . map ( ( filter , i ) => {
100
122
const currentClassName = filter . get ( 'class' ) ;
101
123
const field = filter . get ( 'field' ) ;
0 commit comments