File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -402,13 +402,26 @@ function ConditionEditor(props: ConditionEditorProps): JSX.Element {
402402 // Column not selected
403403 return null ;
404404 }
405+
406+ // Show invalid state only when there's a non-empty value that fails validation
407+ const hasInvalidValue =
408+ ! isValid && conditionValue !== undefined && conditionValue !== '' ;
409+
405410 if ( TableUtils . isNumberType ( selectedColumnType ) ) {
411+ // For IS_BETWEEN, show invalid on each field only if that field has a value
412+ const showInvalid =
413+ selectedCondition === NumberCondition . IS_BETWEEN
414+ ? ! isValid &&
415+ ( ( startValue !== undefined && startValue !== '' ) ||
416+ ( endValue !== undefined && endValue !== '' ) )
417+ : hasInvalidValue ;
418+
406419 return getNumberInputs (
407420 selectedCondition as NumberCondition ,
408421 handleValueChange ,
409422 handleStartValueChange ,
410423 handleEndValueChange ,
411- ! isValid ,
424+ showInvalid ,
412425 conditionValue ,
413426 startValue ,
414427 endValue
@@ -418,23 +431,23 @@ function ConditionEditor(props: ConditionEditorProps): JSX.Element {
418431 return getCharInputs (
419432 selectedCondition as CharCondition ,
420433 handleValueChange ,
421- ! isValid ,
434+ hasInvalidValue ,
422435 conditionValue
423436 ) ;
424437 }
425438 if ( TableUtils . isStringType ( selectedColumnType ) ) {
426439 return getStringInputs (
427440 selectedCondition as StringCondition ,
428441 handleValueChange ,
429- ! isValid ,
442+ hasInvalidValue ,
430443 conditionValue
431444 ) ;
432445 }
433446 if ( TableUtils . isDateType ( selectedColumnType ) ) {
434447 return getDateInputs (
435448 selectedCondition as DateCondition ,
436449 handleValueChange ,
437- ! isValid ,
450+ hasInvalidValue ,
438451 conditionValue
439452 ) ;
440453 }
You can’t perform that action at this time.
0 commit comments