From 70e7e69c484b0f8ae40671ba205d620a473eb42f Mon Sep 17 00:00:00 2001 From: mahmoudadel54 Date: Fri, 1 Dec 2023 11:42:17 +0200 Subject: [PATCH] #9706: fix test case in AttributeFilter file --- .../featuregrid/filterRenderers/AttributeFilter.jsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/web/client/components/data/featuregrid/filterRenderers/AttributeFilter.jsx b/web/client/components/data/featuregrid/filterRenderers/AttributeFilter.jsx index f08abe4785..b70eb24691 100644 --- a/web/client/components/data/featuregrid/filterRenderers/AttributeFilter.jsx +++ b/web/client/components/data/featuregrid/filterRenderers/AttributeFilter.jsx @@ -85,7 +85,7 @@ class AttributeFilter extends React.PureComponent { const placeholder = getMessageById(this.context.messages, this.props.placeholderMsgId) || "Search"; let inputKey = 'header-filter-' + this.props.column.key; let isValueExist = this.state?.value ?? this.props.value; - if (['date', 'time', 'date-time'].includes(this.props.type)) isValueExist = this.state?.value ?? this.props.value?.startDate ?? this.props.value; + if (['date', 'time', 'date-time'].includes(this.props.type) && this.props.isWithinAttrTbl) isValueExist = this.state?.value ?? this.props.value?.startDate ?? this.props.value; let isNullOperator = this.state.operator === 'isNull'; return (
|<=|>=|===|==|=|<|>)?(.*)/.exec(value); - if (match[1]) isValid = false; - if (match[2]) { - if (['integer', 'number'].includes(this.props.type) && isNaN(match[2])) isValid = false; + if (this.props.isWithinAttrTbl) { + const match = /\s*(!==|!=|<>|<=|>=|===|==|=|<|>)?(.*)/.exec(value); + if (match[1]) isValid = false; + if (match[2]) { + if (['integer', 'number'].includes(this.props.type) && isNaN(match[2])) isValid = false; + } } this.setState({value, isInputValid: isValid}); if (isValid) this.props.onChange({value, attribute: this.props.column && this.props.column.key, inputOperator: this.state.operator});