(cherry picked from commit 9aac0d32f9)
Co-authored-by: yinjialu <37073056+yinjialu@users.noreply.github.com>
This commit is contained in:
co-authored by
yinjialu
parent
2576f05029
commit
e71e6ae07e
@@ -25,8 +25,8 @@ export function LabelFilterItem({ item, defaultOp, onChange, onDelete, onGetLabe
|
|||||||
isLoadingLabelValues?: boolean;
|
isLoadingLabelValues?: boolean;
|
||||||
}>({});
|
}>({});
|
||||||
|
|
||||||
const isMultiSelect = () => {
|
const isMultiSelect = (operator = item.op) => {
|
||||||
return operators.find((op) => op.label === item.op)?.isMultiValue;
|
return operators.find((op) => op.label === operator)?.isMultiValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSelectOptionsFromString = (item?: string): string[] => {
|
const getSelectOptionsFromString = (item?: string): string[] => {
|
||||||
@@ -82,7 +82,11 @@ export function LabelFilterItem({ item, defaultOp, onChange, onDelete, onGetLabe
|
|||||||
width="auto"
|
width="auto"
|
||||||
onChange={(change) => {
|
onChange={(change) => {
|
||||||
if (change.value != null) {
|
if (change.value != null) {
|
||||||
onChange({ ...item, op: change.value } as any as QueryBuilderLabelFilter);
|
onChange({
|
||||||
|
...item,
|
||||||
|
op: change.value,
|
||||||
|
value: isMultiSelect(change.value) ? item.value : getSelectOptionsFromString(item?.value)[0],
|
||||||
|
} as any as QueryBuilderLabelFilter);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user