From 44229c6eb6748550da8a5b9893f6a669b44ede0d Mon Sep 17 00:00:00 2001 From: Kriti Jain Date: Tue, 17 Dec 2024 21:00:51 +0530 Subject: [PATCH] adding jsonbArrayType DT --- .../QueryBuilderModal/DataTypeInput/DataTypeInput.js | 5 +++++ .../QueryBuilderModal/DataTypeInput/DataTypeInput.test.js | 6 ++++++ src/QueryBuilder/QueryBuilder/helpers/valueBuilder.js | 2 ++ 3 files changed, 13 insertions(+) diff --git a/src/QueryBuilder/QueryBuilder/QueryBuilderModal/DataTypeInput/DataTypeInput.js b/src/QueryBuilder/QueryBuilder/QueryBuilderModal/DataTypeInput/DataTypeInput.js index d9ef12d..4f9e0c9 100644 --- a/src/QueryBuilder/QueryBuilder/QueryBuilderModal/DataTypeInput/DataTypeInput.js +++ b/src/QueryBuilder/QueryBuilder/QueryBuilderModal/DataTypeInput/DataTypeInput.js @@ -205,6 +205,11 @@ export const DataTypeInput = ({ ? multiSelectControl({ testId: 'data-input-select-multi-arrayType' }) : textControl({ testId: 'data-input-text-arrayType' }); + case DATA_TYPES.JsonbArrayType: + return isContainsRelatedOperator && hasSourceOrValues + ? multiSelectControl({ testId: 'data-input-select-multi-jsonbArrayType' }) + : textControl({ testId: 'data-input-text-jsonbArrayType' }); + case DATA_TYPES.EnumType: return arrayLikeTypeControls(); default: diff --git a/src/QueryBuilder/QueryBuilder/QueryBuilderModal/DataTypeInput/DataTypeInput.test.js b/src/QueryBuilder/QueryBuilder/QueryBuilderModal/DataTypeInput/DataTypeInput.test.js index 75494b7..288466a 100644 --- a/src/QueryBuilder/QueryBuilder/QueryBuilderModal/DataTypeInput/DataTypeInput.test.js +++ b/src/QueryBuilder/QueryBuilder/QueryBuilderModal/DataTypeInput/DataTypeInput.test.js @@ -103,6 +103,12 @@ const arr = [ componentTestId: 'data-input-text-arrayType', onChange: jest.fn(), }, + { + dataType: DATA_TYPES.JsonbArrayType, + operator: OPERATORS.CONTAINS, + componentTestId: 'data-input-text-jsonbArrayType', + onChange: jest.fn(), + }, { dataType: DATA_TYPES.EnumType, operator: OPERATORS.EQUAL, diff --git a/src/QueryBuilder/QueryBuilder/helpers/valueBuilder.js b/src/QueryBuilder/QueryBuilder/helpers/valueBuilder.js index 5999fef..e7515f7 100644 --- a/src/QueryBuilder/QueryBuilder/helpers/valueBuilder.js +++ b/src/QueryBuilder/QueryBuilder/helpers/valueBuilder.js @@ -52,6 +52,8 @@ export const valueBuilder = ({ value, field, operator, fieldOptions, intl, timez [DATA_TYPES.ArrayType]: () => (isArray ? getCommaSeparatedStr(value) : getQuotedStr(value, isInRelatedOperator)), + [DATA_TYPES.JsonbArrayType]: () => (isArray ? getCommaSeparatedStr(value) : getQuotedStr(value, isInRelatedOperator)), + [DATA_TYPES.EnumType]: () => (isArray ? getCommaSeparatedStr(value) : getQuotedStr(value, isInRelatedOperator)), [DATA_TYPES.BooleanType]: () => getQuotedStr(value, isInRelatedOperator),