@@ -33,8 +33,8 @@ export default class ValueField extends PureComponent {
3333
3434 onPropsChanged ( nextProps ) {
3535 const prevProps = this . props ;
36- const keysForItems = [ "config" , "field" , "operator" , "isFuncArg" , "placeholder " ] ;
37- const keysForMeta = [ "config" , "field" , "operator" , "value" , "parentField" ] ;
36+ const keysForItems = [ "config" , "field" , "operator" , "isFuncArg" , "parentField " ] ;
37+ const keysForMeta = [ "config" , "field" , "operator" , "value" , "placeholder" , "isFuncArg" , " parentField"] ;
3838 const needUpdateItems = ! this . items || keysForItems . map ( k => ( nextProps [ k ] !== prevProps [ k ] ) ) . filter ( ch => ch ) . length > 0 ;
3939 const needUpdateMeta = ! this . meta || keysForMeta . map ( k => ( nextProps [ k ] !== prevProps [ k ] ) ) . filter ( ch => ch ) . length > 0 ;
4040
@@ -46,15 +46,14 @@ export default class ValueField extends PureComponent {
4646 }
4747 }
4848
49- getItems ( { config, field, operator, parentField, isFuncArg} ) {
49+ getItems ( { config, field, operator, parentField, isFuncArg, fieldDefinition } ) {
5050 const { canCompareFieldWithField} = config . settings ;
51-
5251 const fieldSeparator = config . settings . fieldSeparator ;
5352 const parentFieldPath = typeof parentField == "string" ? parentField . split ( fieldSeparator ) : parentField ;
5453 const parentFieldConfig = parentField ? getFieldConfig ( config , parentField ) : null ;
5554 const sourceFields = parentField ? parentFieldConfig && parentFieldConfig . subfields : config . fields ;
5655
57- const filteredFields = this . filterFields ( config , sourceFields , field , parentField , parentFieldPath , operator , canCompareFieldWithField , isFuncArg ) ;
56+ const filteredFields = this . filterFields ( config , sourceFields , field , parentField , parentFieldPath , operator , canCompareFieldWithField , isFuncArg , fieldDefinition ) ;
5857 const items = this . buildOptions ( parentFieldPath , config , filteredFields , parentFieldPath ) ;
5958 return items ;
6059 }
@@ -87,13 +86,15 @@ export default class ValueField extends PureComponent {
8786 } ;
8887 }
8988
90- filterFields ( config , fields , leftFieldFullkey , parentField , parentFieldPath , operator , canCompareFieldWithField , isFuncArg ) {
89+ filterFields ( config , fields , leftFieldFullkey , parentField , parentFieldPath , operator , canCompareFieldWithField , isFuncArg , fieldDefinition ) {
9190 fields = clone ( fields ) ;
9291 const fieldSeparator = config . settings . fieldSeparator ;
9392 const leftFieldConfig = getFieldConfig ( config , leftFieldFullkey ) ;
9493 let expectedType ;
9594 const widget = getWidgetForFieldOp ( config , leftFieldFullkey , operator , "value" ) ;
96- if ( widget ) {
95+ if ( isFuncArg && fieldDefinition ) {
96+ expectedType = fieldDefinition . type ;
97+ } else if ( widget ) {
9798 let widgetConfig = config . widgets [ widget ] ;
9899 let widgetType = widgetConfig . type ;
99100 //expectedType = leftFieldConfig.type;
0 commit comments