@evoke-platform/ui-components 1.0.0-dev.128 → 1.0.0-dev.129
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.
@@ -140,7 +140,7 @@ const dynamicContentInputEditor = (props) => {
|
|
140
140
|
return determineValueEditor(valueEditor, props);
|
141
141
|
};
|
142
142
|
const determineValueEditor = (baseValueEditor, props) => {
|
143
|
-
var _a, _b;
|
143
|
+
var _a, _b, _c, _d;
|
144
144
|
const { handleOnChange, value, values, type, operator, inputType } = props;
|
145
145
|
const disabled = ['null', 'notNull'].includes(operator);
|
146
146
|
let valueEditor = baseValueEditor;
|
@@ -183,10 +183,36 @@ const determineValueEditor = (baseValueEditor, props) => {
|
|
183
183
|
}
|
184
184
|
break;
|
185
185
|
case 'number':
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
186
|
+
{
|
187
|
+
const DynamicContentInput = (_d = (_c = props.context) === null || _c === void 0 ? void 0 : _c.dynamicContentInput) === null || _d === void 0 ? void 0 : _d.component;
|
188
|
+
if (DynamicContentInput) {
|
189
|
+
if ((operator === 'in' || operator === 'notIn') && type === 'select' && values) {
|
190
|
+
valueEditor = (React.createElement(Autocomplete, { multiple: true, options: values || [], getOptionLabel: (option) => (option.label ? option.label : ''), value: Array.isArray(value) ? (disabled ? [] : value) : [], disabled: disabled, onChange: (event, newValue) => {
|
191
|
+
const uniqueSelections = Array.from(new Set(newValue.map((item) => item.label))).map((label) => {
|
192
|
+
return newValue.find((item) => item.label === label);
|
193
|
+
});
|
194
|
+
handleOnChange(uniqueSelections.length ? uniqueSelections : '');
|
195
|
+
}, isOptionEqualToValue: (option, value) => {
|
196
|
+
return option === value;
|
197
|
+
}, renderInput: (params) => (React.createElement(TextField, Object.assign({ label: params.label }, params, { size: "small" }))), style: { width: '33%' } }));
|
198
|
+
}
|
199
|
+
else if (type === 'select' && values) {
|
200
|
+
valueEditor = (React.createElement(Autocomplete, { freeSolo: true, options: values, multiple: ['in', 'notIn'].includes(operator), value: disabled ? '' : value, onChange: (event, newValue) => {
|
201
|
+
handleOnChange(newValue === null || newValue === void 0 ? void 0 : newValue.label);
|
202
|
+
}, disabled: disabled, isOptionEqualToValue: (option, value) => {
|
203
|
+
return option === value;
|
204
|
+
}, renderInput: (params) => (React.createElement(TextField, Object.assign({}, params, { size: "small", placeholder: 'Value', readOnly: value === '{{user.id}}', onChange: (event) => {
|
205
|
+
handleOnChange(event.target.value);
|
206
|
+
} }))), style: { width: '33%' }, disableClearable: true }));
|
207
|
+
}
|
208
|
+
}
|
209
|
+
else {
|
210
|
+
valueEditor = (React.createElement(TextField, { value: ['null', 'notNull'].includes(operator) ? '' : value, disabled: ['null', 'notNull'].includes(operator), onChange: (e) => {
|
211
|
+
var _a;
|
212
|
+
handleOnChange((_a = e.target.value) !== null && _a !== void 0 ? _a : '');
|
213
|
+
}, InputProps: { inputComponent: NumericFormat }, placeholder: "Value", size: "small", sx: { width: '33%' } }));
|
214
|
+
}
|
215
|
+
}
|
190
216
|
break;
|
191
217
|
case 'array':
|
192
218
|
valueEditor = (React.createElement(Autocomplete, { multiple: true, options: values || [], getOptionLabel: (option) => (option.label ? option.label : ''), value: Array.isArray(value) ? (disabled ? [] : value) : [], disabled: disabled, onChange: (event, newValue) => {
|