@evoke-platform/ui-components 1.4.0-dev.1 → 1.4.0-dev.3
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.
@@ -27,10 +27,7 @@ const ValueEditor = (props) => {
|
|
27
27
|
if (!!context.treeViewOpts && !!property) {
|
28
28
|
inputType = property.type;
|
29
29
|
if (property.enum) {
|
30
|
-
values = property.enum.map((item) => ({
|
31
|
-
name: item,
|
32
|
-
label: item,
|
33
|
-
}));
|
30
|
+
values = property.enum.map((item) => ({ name: item, label: item }));
|
34
31
|
}
|
35
32
|
}
|
36
33
|
const [invalidDateTime, setInvalidDateTime] = useState(false);
|
@@ -42,8 +39,8 @@ const ValueEditor = (props) => {
|
|
42
39
|
const disabled = ['null', 'notNull'].includes(operator);
|
43
40
|
const presetValues = context.presetValues?.filter((val) => !val.type || val.type === inputType) ?? [];
|
44
41
|
const isPresetValue = (value) => value?.startsWith('{{{') && value?.endsWith('}}}');
|
45
|
-
const
|
46
|
-
const
|
42
|
+
const presetDisplayValue = presetValues?.find((option) => option.value.name === value)?.label;
|
43
|
+
const isPresetValueSelected = presetValues && typeof value === 'string' && isPresetValue(value) && !!presetDisplayValue;
|
47
44
|
let readOnly = context.disabled;
|
48
45
|
if (!readOnly && context.disabledCriteria) {
|
49
46
|
readOnly =
|
@@ -54,9 +51,7 @@ const ValueEditor = (props) => {
|
|
54
51
|
width: '33%',
|
55
52
|
background: readOnly ? '#f4f6f8' : '#fff',
|
56
53
|
borderRadius: '8px',
|
57
|
-
'& .MuiAutocomplete-tag': {
|
58
|
-
backgroundColor: '#edeff1',
|
59
|
-
},
|
54
|
+
'& .MuiAutocomplete-tag': { backgroundColor: '#edeff1' },
|
60
55
|
},
|
61
56
|
};
|
62
57
|
useEffect(() => {
|
@@ -181,9 +176,7 @@ const ValueEditor = (props) => {
|
|
181
176
|
console.error('Error processing date value:', error);
|
182
177
|
setInvalidDateTime(true);
|
183
178
|
}
|
184
|
-
}, onClose: onClose, PopperProps: {
|
185
|
-
anchorEl,
|
186
|
-
}, renderInput: (params) => (React.createElement(Box, { sx: styles.input, ref: setAnchorEl },
|
179
|
+
}, onClose: onClose, PopperProps: { anchorEl }, renderInput: (params) => (React.createElement(Box, { sx: styles.input, ref: setAnchorEl },
|
187
180
|
React.createElement(TextField, { ...params, disabled: disabled, onClick: onClick, placeholder: "Value", size: "small", inputRef: inputRef, error: invalidDateTime }))), readOnly: readOnly })));
|
188
181
|
}
|
189
182
|
else if (inputType === 'number' || inputType === 'integer') {
|
@@ -18,7 +18,58 @@ export const Criteria = (props) => {
|
|
18
18
|
setLoadingError(true);
|
19
19
|
}
|
20
20
|
if (properties) {
|
21
|
-
|
21
|
+
const flattenProperties = properties.flatMap((prop) => {
|
22
|
+
if (prop.type === 'object' || prop.type === 'user') {
|
23
|
+
return [
|
24
|
+
{
|
25
|
+
id: `${prop.id}.id`,
|
26
|
+
name: `${prop.name} Id`,
|
27
|
+
type: 'string',
|
28
|
+
},
|
29
|
+
{
|
30
|
+
id: `${prop.id}.name`,
|
31
|
+
name: `${prop.name} Name`,
|
32
|
+
type: 'string',
|
33
|
+
},
|
34
|
+
];
|
35
|
+
}
|
36
|
+
else if (prop.type === 'address') {
|
37
|
+
return [
|
38
|
+
{
|
39
|
+
id: `${prop.id}.line1`,
|
40
|
+
name: `${prop.name} Line 1`,
|
41
|
+
type: 'string',
|
42
|
+
},
|
43
|
+
{
|
44
|
+
id: `${prop.id}.line2`,
|
45
|
+
name: `${prop.name} Line 2`,
|
46
|
+
type: 'string',
|
47
|
+
},
|
48
|
+
{
|
49
|
+
id: `${prop.id}.city`,
|
50
|
+
name: `${prop.name} City`,
|
51
|
+
type: 'string',
|
52
|
+
},
|
53
|
+
{
|
54
|
+
id: `${prop.id}.county`,
|
55
|
+
name: `${prop.name} County`,
|
56
|
+
type: 'string',
|
57
|
+
},
|
58
|
+
{
|
59
|
+
id: `${prop.id}.state`,
|
60
|
+
name: `${prop.name} State`,
|
61
|
+
type: 'string',
|
62
|
+
},
|
63
|
+
{
|
64
|
+
id: `${prop.id}.zipCode`,
|
65
|
+
name: `${prop.name} Zip Code`,
|
66
|
+
type: 'string',
|
67
|
+
},
|
68
|
+
];
|
69
|
+
}
|
70
|
+
return prop;
|
71
|
+
});
|
72
|
+
setProperties(flattenProperties);
|
22
73
|
setLoadingError(false);
|
23
74
|
}
|
24
75
|
setLoading(false);
|