@evoke-platform/ui-components 1.0.1-dev.5 → 1.0.1-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ const GroupHeader = styled('div')(({ theme }) => ({
|
|
17
17
|
}));
|
18
18
|
const GroupItems = styled('ul')({ padding: 0 });
|
19
19
|
const ValueEditor = (props) => {
|
20
|
-
const { handleOnChange, value, operator, context, level, rule } = props;
|
20
|
+
const { handleOnChange, value, operator, context, level, rule, fieldData } = props;
|
21
21
|
let inputType = props.inputType;
|
22
22
|
let values = props.values;
|
23
23
|
const property = context.propertyTreeMap[rule.field];
|
@@ -111,12 +111,21 @@ const ValueEditor = (props) => {
|
|
111
111
|
}
|
112
112
|
else {
|
113
113
|
const isMultiple = inputType === 'array' || ['in', 'notIn'].includes(operator);
|
114
|
+
const isSelectType = fieldData.valueEditorType === 'select';
|
114
115
|
const options = [
|
115
116
|
...(values?.sort((a, b) => a.label.localeCompare(b.label)) ?? []),
|
116
117
|
...(presetValues?.sort((a, b) => a.label.localeCompare(b.label)) ?? []),
|
117
118
|
];
|
118
119
|
if (isMultiple || values?.length) {
|
119
|
-
return (React.createElement(Autocomplete, { freeSolo: inputType !== 'array' &&
|
120
|
+
return (React.createElement(Autocomplete, { freeSolo: inputType !== 'array' && !isSelectType, multiple: isMultiple, options: options, value: isMultiple
|
121
|
+
? Array.isArray(value)
|
122
|
+
? value
|
123
|
+
: isSelectType && value && typeof value === 'string'
|
124
|
+
? [value]
|
125
|
+
: []
|
126
|
+
: Array.isArray(value)
|
127
|
+
? value.join(',')
|
128
|
+
: value,
|
120
129
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
121
130
|
onChange: (event, newValue) => {
|
122
131
|
let value;
|