@evoke-platform/ui-components 1.0.0-dev.168 → 1.0.0-dev.169
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.
@@ -165,7 +165,8 @@ const CriteriaBuilder = (props) => {
|
|
165
165
|
}, []);
|
166
166
|
const handleQueryChange = (q) => {
|
167
167
|
const updatedQuery = Object.assign(Object.assign({}, q), { rules: q.rules.map((rule) => {
|
168
|
-
|
168
|
+
var _a;
|
169
|
+
return Object.assign(Object.assign({}, rule), { value: Array.isArray(rule.value) && !!((_a = rule.value[0]) === null || _a === void 0 ? void 0 : _a.label)
|
169
170
|
? rule.value.map((item) => item.label)
|
170
171
|
: rule.value });
|
171
172
|
}) });
|
@@ -90,8 +90,16 @@ const ValueEditor = (props) => {
|
|
90
90
|
...((_a = values === null || values === void 0 ? void 0 : values.sort((a, b) => a.label.localeCompare(b.name))) !== null && _a !== void 0 ? _a : []),
|
91
91
|
...((_b = presetValues === null || presetValues === void 0 ? void 0 : presetValues.sort((a, b) => a.label.localeCompare(b.label))) !== null && _b !== void 0 ? _b : [])
|
92
92
|
];
|
93
|
+
const getValue = () => {
|
94
|
+
if (isMultiple) {
|
95
|
+
return Array.isArray(value) && !disabled ? value : [];
|
96
|
+
}
|
97
|
+
else {
|
98
|
+
return disabled ? value : '';
|
99
|
+
}
|
100
|
+
};
|
93
101
|
if (isMultiple || (values === null || values === void 0 ? void 0 : values.length)) {
|
94
|
-
return (React.createElement(Autocomplete, { freeSolo: inputType !== 'array' && inputType !== 'select', multiple: isMultiple, options: options, value:
|
102
|
+
return (React.createElement(Autocomplete, { freeSolo: inputType !== 'array' && inputType !== 'select', multiple: isMultiple, options: options, value: getValue(), disabled: disabled, onChange: (event, newValue) => {
|
95
103
|
var _a, _b, _c;
|
96
104
|
let value;
|
97
105
|
if (isMultiple) {
|
@@ -101,7 +109,9 @@ const ValueEditor = (props) => {
|
|
101
109
|
value = (_c = (_b = newValue === null || newValue === void 0 ? void 0 : newValue.value) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '';
|
102
110
|
}
|
103
111
|
handleOnChange(value);
|
104
|
-
}, renderInput: (params) => (React.createElement(TextField, Object.assign({ inputRef: inputRef, label: params
|
112
|
+
}, renderInput: (params) => (React.createElement(TextField, Object.assign({ inputRef: inputRef, label: params === null || params === void 0 ? void 0 : params.label }, params, { size: "small" }))), isOptionEqualToValue: (option, value) => {
|
113
|
+
return (option === null || option === void 0 ? void 0 : option.label) === (value === null || value === void 0 ? void 0 : value.label);
|
114
|
+
}, groupBy: (option) => { var _a; return isPresetValue((_a = option.value) === null || _a === void 0 ? void 0 : _a.name) ? context.presetGroupLabel || 'Preset Values' : 'Options'; }, renderGroup: groupRenderGroup, sortBy: 'NONE', sx: { width: '33%' } }));
|
105
115
|
}
|
106
116
|
else {
|
107
117
|
return (React.createElement(TextField, { inputRef: inputRef, value: ['null', 'notNull'].includes(operator) ? '' : value, disabled: ['null', 'notNull'].includes(operator), onChange: (e) => handleOnChange(e.target.value), onClick: onClick, placeholder: "Value", size: "small", sx: { width: '33%' } }));
|