Made Fields immutable for Applications (#20799)

* Made dropdown immutable for input field

* added tests

* removed test
This commit is contained in:
Dhruv Parmar 2025-04-15 14:32:15 +05:30 committed by Ayush Shah
parent fcc3f4810a
commit a7751fbb82
3 changed files with 18 additions and 1 deletions

View File

@ -51,6 +51,7 @@ import {
elasticsearchToJsonLogic, elasticsearchToJsonLogic,
getJsonTreeFromQueryFilter, getJsonTreeFromQueryFilter,
jsonLogicToElasticsearch, jsonLogicToElasticsearch,
READONLY_SETTINGS,
} from '../../../../../../utils/QueryBuilderUtils'; } from '../../../../../../utils/QueryBuilderUtils';
import searchClassBase from '../../../../../../utils/SearchClassBase'; import searchClassBase from '../../../../../../utils/SearchClassBase';
import { withAdvanceSearch } from '../../../../../AppRouter/withAdvanceSearch'; import { withAdvanceSearch } from '../../../../../AppRouter/withAdvanceSearch';
@ -266,6 +267,10 @@ const QueryBuilderWidget: FC<WidgetProps> = ({
<Builder {...props} /> <Builder {...props} />
</div> </div>
)} )}
settings={{
...config.settings,
...(props.readonly ? READONLY_SETTINGS : {}),
}}
value={treeInternal} value={treeInternal}
onChange={handleChange} onChange={handleChange}
/> />

View File

@ -50,6 +50,11 @@
} }
.query-builder-form-field { .query-builder-form-field {
.ant-select-disabled.ant-select:not(.ant-select-customize-input)
.ant-select-selector {
color: @black;
background-color: @background-color;
}
.hide--line.one--child { .hide--line.one--child {
margin-top: 0; margin-top: 0;
padding-top: 16px; padding-top: 16px;

View File

@ -94,7 +94,14 @@ export const getSelectEqualsNotEqualsProperties = (
}, },
}; };
}; };
export const READONLY_SETTINGS = {
immutableGroupsMode: true,
immutableFieldsMode: true,
immutableOpsMode: true,
immutableValuesMode: true,
canRegroup: false,
canRemove: false,
};
export const getSelectAnyInProperties = ( export const getSelectAnyInProperties = (
parentPath: Array<string>, parentPath: Array<string>,
termObjects: Array<EsTerm> termObjects: Array<EsTerm>