@evoke-platform/ui-components 1.0.1-testing.0 → 1.0.1-testing.2
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.
@@ -174,6 +174,9 @@ const customSelector = (props) => {
|
|
174
174
|
else if (inputType === 'string') {
|
175
175
|
opts = options.filter((option) => !['>', '<', '<=', '>='].includes(option.name));
|
176
176
|
}
|
177
|
+
else if (inputType === 'image') {
|
178
|
+
opts = options.filter((option) => ['=', '!=', 'null', 'notNull'].includes(option.name));
|
179
|
+
}
|
177
180
|
break;
|
178
181
|
case 'Fields':
|
179
182
|
placeholder = 'Select Property';
|
@@ -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
|
20
|
+
const { handleOnChange, value, operator, context, level, rule } = props;
|
21
21
|
let inputType = props.inputType;
|
22
22
|
let values = props.values;
|
23
23
|
const property = context.propertyTreeMap[rule.field];
|
@@ -111,21 +111,12 @@ const ValueEditor = (props) => {
|
|
111
111
|
}
|
112
112
|
else {
|
113
113
|
const isMultiple = inputType === 'array' || ['in', 'notIn'].includes(operator);
|
114
|
-
const isSelectType = fieldData.valueEditorType === 'select';
|
115
114
|
const options = [
|
116
115
|
...(values?.sort((a, b) => a.label.localeCompare(b.label)) ?? []),
|
117
116
|
...(presetValues?.sort((a, b) => a.label.localeCompare(b.label)) ?? []),
|
118
117
|
];
|
119
118
|
if (isMultiple || values?.length) {
|
120
|
-
return (React.createElement(Autocomplete, { freeSolo: inputType !== 'array' &&
|
121
|
-
? Array.isArray(value)
|
122
|
-
? value
|
123
|
-
: isSelectType && value && typeof value === 'string'
|
124
|
-
? [value]
|
125
|
-
: []
|
126
|
-
: Array.isArray(value)
|
127
|
-
? value.join(',')
|
128
|
-
: value,
|
119
|
+
return (React.createElement(Autocomplete, { freeSolo: inputType !== 'array' && inputType !== 'select', multiple: isMultiple, options: options, value: isMultiple ? (Array.isArray(value) ? value : []) : value,
|
129
120
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
130
121
|
onChange: (event, newValue) => {
|
131
122
|
let value;
|
@@ -139,11 +130,11 @@ const ValueEditor = (props) => {
|
|
139
130
|
}
|
140
131
|
handleOnChange(value);
|
141
132
|
}, onBlur: () => {
|
142
|
-
if (inputValue) {
|
133
|
+
if (inputValue && (operator === 'in' || operator === 'notIn')) {
|
143
134
|
const newValues = Array.isArray(value) ? [...value, inputValue] : [inputValue];
|
144
135
|
handleOnChange(Array.from(new Set(newValues)));
|
136
|
+
setInputValue('');
|
145
137
|
}
|
146
|
-
setInputValue('');
|
147
138
|
}, onInputChange: (event, newInputValue) => {
|
148
139
|
setInputValue(newInputValue);
|
149
140
|
}, inputValue: inputValue, renderInput: (params) => (React.createElement(TextField, { inputRef: inputRef, label: params?.label, ...params, size: "small", sx: { backgroundColor: '#fff' } })),
|