From 3e51e1a041ee2d603c95b25ba68bc3f9b2faa8e3 Mon Sep 17 00:00:00 2001 From: mahmoudadel Date: Tue, 30 Jul 2024 11:06:58 +0300 Subject: [PATCH] #10488: 'ilike' as default operator for text field in attribute table quick filter [resolve review comments] Description: - replace operator prop with defaultOperator - remove unused prop operator from BaseDateTimeFilter component --- .../data/featuregrid/filterRenderers/AttributeFilter.jsx | 6 +++--- .../data/featuregrid/filterRenderers/BaseDateTimeFilter.js | 4 ++-- .../data/featuregrid/filterRenderers/StringFilter.jsx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/web/client/components/data/featuregrid/filterRenderers/AttributeFilter.jsx b/web/client/components/data/featuregrid/filterRenderers/AttributeFilter.jsx index dc28a76310..bedcf9c657 100644 --- a/web/client/components/data/featuregrid/filterRenderers/AttributeFilter.jsx +++ b/web/client/components/data/featuregrid/filterRenderers/AttributeFilter.jsx @@ -23,7 +23,7 @@ class AttributeFilter extends React.PureComponent { column: PropTypes.object, placeholderMsgId: PropTypes.string, tooltipMsgId: PropTypes.string, - operator: PropTypes.string, + defaultOperator: PropTypes.string, type: PropTypes.string, isWithinAttrTbl: PropTypes.bool }; @@ -38,7 +38,7 @@ class AttributeFilter extends React.PureComponent { onChange: () => {}, column: {}, placeholderMsgId: "featuregrid.filter.placeholders.default", - operator: "=", + defaultOperator: "=", isWithinAttrTbl: false }; constructor(props) { @@ -50,7 +50,7 @@ class AttributeFilter extends React.PureComponent { booleanOperators: ["="], defaultOperators: ["=", ">", "<", ">=", "<=", "<>", "isNull"], timeDateOperators: ["=", ">", "<", ">=", "<=", "<>", "><", "isNull"], - operator: this.props.isWithinAttrTbl ? (this.props.operator || '=') : "", + operator: this.props.isWithinAttrTbl ? (this.props.defaultOperator) : "", isInputValid: true }; } diff --git a/web/client/components/data/featuregrid/filterRenderers/BaseDateTimeFilter.js b/web/client/components/data/featuregrid/filterRenderers/BaseDateTimeFilter.js index 1e04116388..dc2a97aeba 100644 --- a/web/client/components/data/featuregrid/filterRenderers/BaseDateTimeFilter.js +++ b/web/client/components/data/featuregrid/filterRenderers/BaseDateTimeFilter.js @@ -104,7 +104,7 @@ export class DateFilter extends AttributeFilter { />); } handleChange = (value, stringValue) => { - this.props.onChange({ value, stringValue, attribute: this.props.column && this.props.column.name, inputOperator: this.state.operator || this.props.operator }); + this.props.onChange({ value, stringValue, attribute: this.props.column && this.props.column.name, inputOperator: this.state.operator }); } handleChangeRangeFilter = (value, stringValue, order = 'start') => { let reqVal = {}; @@ -119,7 +119,7 @@ export class DateFilter extends AttributeFilter { endDate: this.props.value?.endDate }; } - this.props.onChange({ value: reqVal, stringValue, attribute: this.props.column && this.props.column.name, inputOperator: this.state.operator || this.props.operator }); + this.props.onChange({ value: reqVal, stringValue, attribute: this.props.column && this.props.column.name, inputOperator: this.state.operator }); } } diff --git a/web/client/components/data/featuregrid/filterRenderers/StringFilter.jsx b/web/client/components/data/featuregrid/filterRenderers/StringFilter.jsx index 4d781ef033..2ea18a3038 100644 --- a/web/client/components/data/featuregrid/filterRenderers/StringFilter.jsx +++ b/web/client/components/data/featuregrid/filterRenderers/StringFilter.jsx @@ -6,7 +6,7 @@ export default compose( defaultProps({ onValueChange: () => {}, placeholderMsgId: "featuregrid.filter.placeholders.string", - operator: 'ilike' + defaultOperator: 'ilike' }), withHandlers({ onChange: props => ({value, attribute, inputOperator} = {}) => {