@evoke-platform/ui-components 1.0.0-dev.226 → 1.0.0-dev.228
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.
- package/dist/published/components/core/Accordion/Accordion.js +1 -1
- package/dist/published/components/core/Accordion/AccordionActions/AccordionActions.js +1 -1
- package/dist/published/components/core/Accordion/AccordionDetails/AccordionDetails.js +1 -1
- package/dist/published/components/core/Accordion/AccordionSummary/AccordionSummary.js +1 -1
- package/dist/published/components/core/Alert/Alert.js +8 -9
- package/dist/published/components/core/AlertTitle/AlertTitle.js +1 -1
- package/dist/published/components/core/AppBar/AppBar.js +1 -1
- package/dist/published/components/core/Autocomplete/Autocomplete.js +33 -15
- package/dist/published/components/core/Autocomplete/Autocomplete.test.js +1 -1
- package/dist/published/components/core/Avatar/Avatar.js +7 -4
- package/dist/published/components/core/Backdrop/Backdrop.js +1 -1
- package/dist/published/components/core/Badge/Badge.js +1 -1
- package/dist/published/components/core/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/published/components/core/Button/Button.js +1 -1
- package/dist/published/components/core/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/published/components/core/Card/Card.js +1 -1
- package/dist/published/components/core/Checkbox/Checkbox.js +1 -1
- package/dist/published/components/core/Chip/Chip.js +1 -1
- package/dist/published/components/core/CircularProgress/CircularProgress.js +1 -1
- package/dist/published/components/core/Collapse/Collapse.js +1 -1
- package/dist/published/components/core/DatePicker/DatePicker.js +4 -16
- package/dist/published/components/core/DateTimePicker/DateTimePicker.js +3 -15
- package/dist/published/components/core/Dialog/Dialog.js +1 -1
- package/dist/published/components/core/Dialog/DialogActions/DialogActions.js +2 -13
- package/dist/published/components/core/Dialog/DialogContent/DialogContent.js +1 -1
- package/dist/published/components/core/Dialog/DialogContentText/DialogContentText.js +1 -1
- package/dist/published/components/core/Dialog/DialogTitle/DialogTitle.js +1 -1
- package/dist/published/components/core/Divider/Divider.js +1 -1
- package/dist/published/components/core/Drawer/Drawer.js +1 -1
- package/dist/published/components/core/FieldError/FieldError.js +1 -2
- package/dist/published/components/core/FormElements/FormControl/FormControl.js +1 -1
- package/dist/published/components/core/FormElements/FormControlLabel/FormControlLabel.js +1 -1
- package/dist/published/components/core/FormElements/FormGroup/FormGroup.js +1 -1
- package/dist/published/components/core/FormElements/FormHelperText/FormHelperText.js +1 -1
- package/dist/published/components/core/FormElements/FormLabel/FormLabel.js +1 -1
- package/dist/published/components/core/IconButton/IconButton.js +1 -1
- package/dist/published/components/core/LinearProgress/LinearProgress.js +1 -1
- package/dist/published/components/core/Link/Link.js +1 -1
- package/dist/published/components/core/List/List.js +1 -1
- package/dist/published/components/core/List/ListItem.js +1 -1
- package/dist/published/components/core/List/ListItemText/ListItemText.js +1 -1
- package/dist/published/components/core/LoadingButton/LoadingButton.js +1 -1
- package/dist/published/components/core/LocalizationProvider/LocalizationProvider.js +3 -14
- package/dist/published/components/core/Menu/Menu.js +1 -1
- package/dist/published/components/core/Menu/MenuItem/MenuItem.js +1 -1
- package/dist/published/components/core/Paper/Paper.js +1 -1
- package/dist/published/components/core/Popover/Popover.js +1 -1
- package/dist/published/components/core/Popper/Popper.js +1 -1
- package/dist/published/components/core/RadioGroup/Radio.js +1 -1
- package/dist/published/components/core/RadioGroup/RadioGroup.js +1 -1
- package/dist/published/components/core/Select/Select.js +11 -4
- package/dist/published/components/core/Skeleton/Skeleton.js +1 -1
- package/dist/published/components/core/Snackbar/Snackbar.js +2 -2
- package/dist/published/components/core/StaticDatePicker/StaticDatePicker.js +3 -15
- package/dist/published/components/core/Stepper/Step/Step.js +1 -1
- package/dist/published/components/core/Stepper/StepButton/StepButton.js +1 -1
- package/dist/published/components/core/Stepper/StepConnector/StepConnector.js +1 -1
- package/dist/published/components/core/Stepper/StepContent/StepContent.js +1 -1
- package/dist/published/components/core/Stepper/StepIcon/StepIcon.js +1 -1
- package/dist/published/components/core/Stepper/StepLabel/StepLabel.js +1 -1
- package/dist/published/components/core/Stepper/Stepper.js +1 -1
- package/dist/published/components/core/Switch/Switch.js +1 -1
- package/dist/published/components/core/Table/Table.js +1 -1
- package/dist/published/components/core/Tabs/Tab/Tab.js +1 -1
- package/dist/published/components/core/Tabs/Tabs.js +1 -1
- package/dist/published/components/core/TextField/TextField.js +12 -6
- package/dist/published/components/core/ToggleButton/ToggleButton.js +1 -1
- package/dist/published/components/core/ToggleButtonGroup/ToggleButtonGroup.js +1 -1
- package/dist/published/components/core/Tooltip/Tooltip.js +15 -2
- package/dist/published/components/core/Typography/index.js +1 -1
- package/dist/published/components/custom/BuilderGrid/BuilderGrid.js +33 -29
- package/dist/published/components/custom/BuilderGrid/BuilderGridToolbar.js +1 -2
- package/dist/published/components/custom/BuilderGrid/EmptyContent.js +4 -5
- package/dist/published/components/custom/BuilderGrid/EmptyContentIllustration.js +6 -1
- package/dist/published/components/custom/BuilderGrid/ToolbarActions.js +3 -1
- package/dist/published/components/custom/CriteriaBuilder/CriteriaBuilder.js +46 -27
- package/dist/published/components/custom/CriteriaBuilder/CriteriaBuilder.test.js +12 -21
- package/dist/published/components/custom/CriteriaBuilder/ValueEditor.js +27 -34
- package/dist/published/components/custom/DataGrid/DataGrid.js +38 -33
- package/dist/published/components/custom/DataGrid/DateTimeCustomOperator.js +3 -5
- package/dist/published/components/custom/DataGrid/Toolbar.js +3 -4
- package/dist/published/components/custom/ErrorComponent/ErrorComponent.js +11 -1
- package/dist/published/components/custom/Form/Common/Form.js +106 -80
- package/dist/published/components/custom/Form/Common/FormComponentWrapper.js +20 -11
- package/dist/published/components/custom/Form/FormComponents/ButtonComponent.js +9 -20
- package/dist/published/components/custom/Form/FormComponents/DocumentComponent/Document.js +10 -20
- package/dist/published/components/custom/Form/FormComponents/DocumentComponent/DocumentComponent.js +24 -28
- package/dist/published/components/custom/Form/FormComponents/DocumentComponent/DocumentList.js +49 -64
- package/dist/published/components/custom/Form/FormComponents/FormFieldComponent.d.ts +1 -0
- package/dist/published/components/custom/Form/FormComponents/FormFieldComponent.js +109 -34
- package/dist/published/components/custom/Form/FormComponents/ImageComponent/Image.d.ts +2 -0
- package/dist/published/components/custom/Form/FormComponents/ImageComponent/Image.js +13 -25
- package/dist/published/components/custom/Form/FormComponents/ImageComponent/ImageComponent.d.ts +3 -1
- package/dist/published/components/custom/Form/FormComponents/ImageComponent/ImageComponent.js +30 -9
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/InstanceLookup.js +26 -31
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectComponent.d.ts +5 -4
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectComponent.js +70 -22
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectPropertyInput.js +93 -75
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/RelatedObjectInstance.d.ts +2 -2
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/RelatedObjectInstance.js +17 -26
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ActionDialog.js +20 -24
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ManyToMany/DropdownRepeatableField.js +22 -33
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ManyToMany/DropdownRepeatableFieldInput.js +12 -9
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/RepeatableField.js +105 -82
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/RepeatableFieldComponent.js +8 -6
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserComponent.d.ts +3 -1
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserComponent.js +55 -12
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserProperty.js +32 -30
- package/dist/published/components/custom/Form/FormComponents/ViewOnlyComponent.js +12 -9
- package/dist/published/components/custom/Form/types.d.ts +5 -5
- package/dist/published/components/custom/Form/utils.js +611 -446
- package/dist/published/components/custom/FormField/AddressFieldComponent/AddressFieldComponent.test.js +41 -54
- package/dist/published/components/custom/FormField/AddressFieldComponent/addressFieldComponent.js +7 -8
- package/dist/published/components/custom/FormField/BooleanSelect/BooleanSelect.js +1 -1
- package/dist/published/components/custom/FormField/BooleanSelect/BooleanSelect.test.js +5 -14
- package/dist/published/components/custom/FormField/DatePickerSelect/DatePickerSelect.js +2 -2
- package/dist/published/components/custom/FormField/DatePickerSelect/DatePickerSelect.test.js +12 -21
- package/dist/published/components/custom/FormField/DateTimePickerSelect/DateTimePickerSelect.js +2 -2
- package/dist/published/components/custom/FormField/DateTimePickerSelect/DateTimePickerSelect.test.js +12 -21
- package/dist/published/components/custom/FormField/FileUpload/FileUpload.js +10 -11
- package/dist/published/components/custom/FormField/FormField.js +10 -10
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js +22 -30
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.test.js +8 -17
- package/dist/published/components/custom/FormField/Select/Select.js +5 -6
- package/dist/published/components/custom/FormField/Select/Select.test.js +18 -27
- package/dist/published/components/custom/FormField/TimePickerSelect/TimePickerSelect.js +4 -4
- package/dist/published/components/custom/HistoryLog/DisplayedProperty.js +12 -13
- package/dist/published/components/custom/HistoryLog/HistoryData.js +49 -45
- package/dist/published/components/custom/HistoryLog/HistoryLoading.js +5 -5
- package/dist/published/components/custom/HistoryLog/index.js +5 -6
- package/dist/published/components/custom/Menubar/Menubar.js +2 -2
- package/dist/published/components/custom/MultiSelect/MultiSelect.js +38 -50
- package/dist/published/components/custom/MultiSelect/SortableItem.js +1 -1
- package/dist/published/components/custom/RepeatableField/RepeatableField.js +14 -16
- package/dist/published/components/custom/UserAvatar/UserAvatar.js +12 -5
- package/dist/published/components/custom/util.js +1 -1
- package/dist/published/components/layout/Box/Box.js +1 -1
- package/dist/published/components/layout/Container/Container.js +1 -1
- package/dist/published/components/layout/Grid/Grid.js +1 -1
- package/dist/published/components/layout/Stack/Stack.js +1 -1
- package/dist/published/icons/custom/FileWithExtension.js +8 -4
- package/dist/published/icons/custom/Inherited.js +8 -6
- package/dist/published/icons/custom/Overrides.js +9 -7
- package/dist/published/icons/custom/TrashCan.js +10 -8
- package/dist/published/icons/custom/UploadCloud.js +9 -7
- package/dist/published/stories/Accordion.stories.js +2 -2
- package/dist/published/stories/Alert.stories.js +1 -1
- package/dist/published/stories/AlertTitle.stories.js +1 -1
- package/dist/published/stories/Autocomplete.stories.js +2 -2
- package/dist/published/stories/Avatar.stories.js +1 -1
- package/dist/published/stories/Backdrop.stories.js +1 -1
- package/dist/published/stories/Badge.stories.js +1 -1
- package/dist/published/stories/Box.stories.js +2 -2
- package/dist/published/stories/Breadcrumbs.stories.js +1 -1
- package/dist/published/stories/Button.stories.js +1 -1
- package/dist/published/stories/ButtonGroup.stories.js +1 -1
- package/dist/published/stories/Card.stories.js +1 -1
- package/dist/published/stories/Checkbox.stories.js +1 -1
- package/dist/published/stories/Chip.stories.js +1 -1
- package/dist/published/stories/CircularProgress.stories.js +1 -1
- package/dist/published/stories/Collapse.stories.js +1 -1
- package/dist/published/stories/Container.stories.js +1 -1
- package/dist/published/stories/CriteriaBuilder.stories.js +7 -3
- package/dist/published/stories/DataGrid.stories.js +3 -3
- package/dist/published/stories/DatePicker.stories.js +3 -14
- package/dist/published/stories/Dialog.stories.js +1 -1
- package/dist/published/stories/Divider.stories.js +1 -1
- package/dist/published/stories/Drawer.stories.js +2 -2
- package/dist/published/stories/FormControl.stories.js +1 -1
- package/dist/published/stories/FormControlLabel.stories.js +1 -1
- package/dist/published/stories/FormField.stories.js +3 -12
- package/dist/published/stories/FormGroup.stories.js +1 -1
- package/dist/published/stories/FormHelperText.stories.js +1 -1
- package/dist/published/stories/FormLabel.stories.js +1 -1
- package/dist/published/stories/Grid.stories.js +1 -1
- package/dist/published/stories/HistoryLog.stories.js +1 -1
- package/dist/published/stories/IconButton.stories.js +4 -4
- package/dist/published/stories/LinearProgress.stories.js +1 -1
- package/dist/published/stories/Link.stories.js +1 -1
- package/dist/published/stories/List.stories.js +2 -2
- package/dist/published/stories/Menu.stories.js +2 -2
- package/dist/published/stories/MenuBar.stories.js +1 -1
- package/dist/published/stories/MultiSelect.stories.js +3 -3
- package/dist/published/stories/Palette.stories.js +11 -11
- package/dist/published/stories/Paper.stories.js +1 -1
- package/dist/published/stories/RadioGroup.stories.js +1 -1
- package/dist/published/stories/RepeatableField.stories.js +6 -7
- package/dist/published/stories/RichTextViewer.stories.js +1 -1
- package/dist/published/stories/Skeleton.stories.js +1 -1
- package/dist/published/stories/Snackbar.stories.js +1 -1
- package/dist/published/stories/Stack.stories.js +1 -1
- package/dist/published/stories/StaticDatePicker.stories.js +3 -14
- package/dist/published/stories/Stepper.stories.js +3 -3
- package/dist/published/stories/Switch.stories.js +1 -1
- package/dist/published/stories/Table.stories.js +2 -2
- package/dist/published/stories/Tabs.stories.js +6 -17
- package/dist/published/stories/TextField.stories.js +1 -1
- package/dist/published/stories/TimePicker.stories.js +3 -14
- package/dist/published/stories/TimePickerSelect.stories.js +3 -14
- package/dist/published/stories/ToggleButton.stories.js +4 -4
- package/dist/published/theme/UIThemeProvider.js +1 -2
- package/package.json +1 -1
@@ -16,13 +16,13 @@ export const DropdownRepeatableFieldInput = (props) => {
|
|
16
16
|
if (manyToManyPropertyId) {
|
17
17
|
const enums = endObjectInstances
|
18
18
|
.map((endObjectInstance) => {
|
19
|
-
const normalizedInstance =
|
19
|
+
const normalizedInstance = { ...endObjectInstance };
|
20
20
|
normalizeDates([normalizedInstance], endObject);
|
21
21
|
return normalizedInstance;
|
22
22
|
})
|
23
23
|
.map((endObjectInstance) => ({
|
24
24
|
label: endObjectInstance.name,
|
25
|
-
subLabel:
|
25
|
+
subLabel: layout?.secondaryTextExpression
|
26
26
|
? compileExpression(endObjectInstance, layout.secondaryTextExpression)
|
27
27
|
: undefined,
|
28
28
|
endObjectId: endObjectInstance.id,
|
@@ -32,7 +32,7 @@ export const DropdownRepeatableFieldInput = (props) => {
|
|
32
32
|
...enums,
|
33
33
|
...selectedOptions
|
34
34
|
.filter((selectedOption) => !enums.find((availableOption) => availableOption.endObjectId === selectedOption.endObjectId))
|
35
|
-
.map((option) => (
|
35
|
+
.map((option) => ({ ...option, hidden: true })),
|
36
36
|
]);
|
37
37
|
}
|
38
38
|
}, [endObjectInstances, layout]);
|
@@ -64,12 +64,15 @@ export const DropdownRepeatableFieldInput = (props) => {
|
|
64
64
|
return template(instance);
|
65
65
|
};
|
66
66
|
return (React.createElement(React.Fragment, null, !readOnly ? (property && (React.createElement(React.Fragment, null,
|
67
|
-
React.createElement(FormField, { id: id, property:
|
67
|
+
React.createElement(FormField, { id: id, property: {
|
68
|
+
...property,
|
69
|
+
type: 'array',
|
68
70
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
69
|
-
enum: selectOptions
|
71
|
+
enum: selectOptions,
|
72
|
+
}, onChange: handleChange, defaultValue: selectedOptions, isOptionEqualToValue: (option, value) => isDropdownRepeatableFieldInputOption(value) &&
|
70
73
|
isDropdownRepeatableFieldInputOption(option) &&
|
71
|
-
option.endObjectId === value.endObjectId, size: fieldHeight
|
72
|
-
return isObject(props) && isDropdownRepeatableFieldInputOption(option) ? (React.createElement("li",
|
74
|
+
option.endObjectId === value.endObjectId, size: fieldHeight ?? 'medium', renderOption: (props, option) => {
|
75
|
+
return isObject(props) && isDropdownRepeatableFieldInputOption(option) ? (React.createElement("li", { ...props, key: option.endObjectId },
|
73
76
|
React.createElement(Typography, null,
|
74
77
|
option.label,
|
75
78
|
React.createElement("br", null),
|
@@ -79,9 +82,9 @@ export const DropdownRepeatableFieldInput = (props) => {
|
|
79
82
|
return options.filter((option) => !option.hidden);
|
80
83
|
},
|
81
84
|
inputValue: searchValue,
|
82
|
-
renderInput: (params) => (React.createElement(TextField,
|
85
|
+
renderInput: (params) => (React.createElement(TextField, { ...params, onChange: (event) => {
|
83
86
|
setSearchValue(event.target.value);
|
84
|
-
} }))
|
87
|
+
} })),
|
85
88
|
loading: loading,
|
86
89
|
} }),
|
87
90
|
React.createElement(Snackbar, { open: snackbarError.showAlert, handleClose: () => setSnackbarError({ isError: snackbarError.isError, showAlert: false }), message: snackbarError.message, error: snackbarError.isError })))) : (React.createElement(Typography, null, selectedOptions && selectedOptions.map((option) => option.label).join(', ')))));
|
@@ -1,12 +1,3 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
1
|
import { useNotification, } from '@evoke-platform/context';
|
11
2
|
import { LocalDateTime } from '@js-joda/core';
|
12
3
|
import { get, isObject, pick, startCase } from 'lodash';
|
@@ -40,7 +31,6 @@ const styles = {
|
|
40
31
|
},
|
41
32
|
};
|
42
33
|
const RepeatableField = (props) => {
|
43
|
-
var _a, _b;
|
44
34
|
const { property, instance, canUpdateProperty, apiServices, queryAddresses, user, viewLayout } = props;
|
45
35
|
const [relatedInstances, setRelatedInstances] = useState([]);
|
46
36
|
const [relatedObject, setRelatedObject] = useState();
|
@@ -59,17 +49,21 @@ const RepeatableField = (props) => {
|
|
59
49
|
const [error, setError] = useState(false);
|
60
50
|
const DEFAULT_CREATE_ACTION = '_create';
|
61
51
|
const { instanceChanges } = useNotification();
|
62
|
-
const fetchRelatedInstances = useCallback(() =>
|
63
|
-
var _c;
|
52
|
+
const fetchRelatedInstances = useCallback(async () => {
|
64
53
|
if (openDialog)
|
65
54
|
return;
|
66
55
|
let relatedObject;
|
67
56
|
if (property.objectId) {
|
68
57
|
try {
|
69
|
-
relatedObject =
|
58
|
+
relatedObject = await apiServices.get(getPrefixedUrl(`/objects/${property.objectId}/effective`));
|
70
59
|
let defaultTableViewLayout;
|
71
|
-
if (
|
72
|
-
defaultTableViewLayout =
|
60
|
+
if (relatedObject.viewLayout?.table) {
|
61
|
+
defaultTableViewLayout = {
|
62
|
+
id: 'default',
|
63
|
+
name: 'Default',
|
64
|
+
objectId: relatedObject.id,
|
65
|
+
...relatedObject?.viewLayout.table,
|
66
|
+
};
|
73
67
|
}
|
74
68
|
if (viewLayout) {
|
75
69
|
apiServices
|
@@ -85,16 +79,16 @@ const RepeatableField = (props) => {
|
|
85
79
|
catch (err) {
|
86
80
|
console.error(error);
|
87
81
|
}
|
88
|
-
if (property.relatedPropertyId &&
|
82
|
+
if (property.relatedPropertyId && instance?.id) {
|
89
83
|
const filterProperty = `${property.relatedPropertyId}.id`;
|
90
|
-
const filter = { where: { [filterProperty]: instance
|
84
|
+
const filter = { where: { [filterProperty]: instance?.id }, limit: 100 };
|
91
85
|
const objectId = property.objectId;
|
92
86
|
try {
|
93
87
|
const timeout = setTimeout(() => {
|
94
88
|
setLoading(false);
|
95
89
|
}, 300);
|
96
90
|
setLoading(true);
|
97
|
-
const instances =
|
91
|
+
const instances = await apiServices.get(getPrefixedUrl(`/objects/${objectId}/instances`), {
|
98
92
|
params: { filter: JSON.stringify(filter) },
|
99
93
|
});
|
100
94
|
clearTimeout(timeout);
|
@@ -109,7 +103,49 @@ const RepeatableField = (props) => {
|
|
109
103
|
}
|
110
104
|
}
|
111
105
|
relatedObject && checkCreateAccess(relatedObject);
|
112
|
-
}
|
106
|
+
}, [apiServices, property, viewLayout]);
|
107
|
+
const retrieveCriteria = (relatedObjProperty, action, object) => {
|
108
|
+
let property;
|
109
|
+
if (action.parameters) {
|
110
|
+
property = action.parameters.find((param) => param.id === relatedObjProperty);
|
111
|
+
return {
|
112
|
+
relatedObjectProperty: property,
|
113
|
+
criteria: property?.validation?.criteria,
|
114
|
+
};
|
115
|
+
}
|
116
|
+
else if (action.inputProperties) {
|
117
|
+
const flattenInputProperties = (entries) => {
|
118
|
+
return entries.reduce((acc, entry) => {
|
119
|
+
if (entry.components) {
|
120
|
+
const components = entry.components.flatMap((s) => s.components ?? []);
|
121
|
+
return acc.concat(flattenInputProperties(components ?? []));
|
122
|
+
}
|
123
|
+
else if (entry.columns) {
|
124
|
+
const components = entry.columns.flatMap((c) => c.components ?? []);
|
125
|
+
return acc.concat(flattenInputProperties(components ?? []));
|
126
|
+
}
|
127
|
+
else if (entry.html) {
|
128
|
+
return acc;
|
129
|
+
}
|
130
|
+
else {
|
131
|
+
return acc.concat([entry]);
|
132
|
+
}
|
133
|
+
}, []);
|
134
|
+
};
|
135
|
+
property = flattenInputProperties(action.inputProperties).find((param) => param.key === relatedObjProperty);
|
136
|
+
return {
|
137
|
+
relatedObjectProperty: property,
|
138
|
+
criteria: (property?.validate).criteria,
|
139
|
+
};
|
140
|
+
}
|
141
|
+
else {
|
142
|
+
property = object.properties?.find((prop) => prop.id === relatedObjProperty);
|
143
|
+
return {
|
144
|
+
relatedObjectProperty: property,
|
145
|
+
criteria: property?.validation?.criteria,
|
146
|
+
};
|
147
|
+
}
|
148
|
+
};
|
113
149
|
const checkCreateAccess = (relatedObject) => {
|
114
150
|
if (property.objectId && canUpdateProperty) {
|
115
151
|
apiServices
|
@@ -117,36 +153,15 @@ const RepeatableField = (props) => {
|
|
117
153
|
params: { action: 'execute', field: '_create', scope: 'data' },
|
118
154
|
})
|
119
155
|
.then((checkAccess) => {
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
if (action.parameters) {
|
126
|
-
relatedObjectProperty = action.parameters.find((param) => param.id === property.relatedPropertyId);
|
127
|
-
validationCriteria = (_b = relatedObjectProperty === null || relatedObjectProperty === void 0 ? void 0 : relatedObjectProperty.validation) === null || _b === void 0 ? void 0 : _b.criteria;
|
128
|
-
}
|
129
|
-
else if (action.inputProperties) {
|
130
|
-
relatedObjectProperty = action.inputProperties.find((inputProp) => inputProp.key === property.relatedPropertyId);
|
131
|
-
validationCriteria = (_c = relatedObjectProperty === null || relatedObjectProperty === void 0 ? void 0 : relatedObjectProperty.validate) === null || _c === void 0 ? void 0 : _c.criteria;
|
156
|
+
const action = relatedObject.actions?.find((item) => item.id === '_create');
|
157
|
+
if (action && property.relatedPropertyId) {
|
158
|
+
const { relatedObjectProperty, criteria } = retrieveCriteria(property.relatedPropertyId, action, relatedObject);
|
159
|
+
if (!criteria || JSON.stringify(criteria).includes('{{{input.') || !relatedObjectProperty) {
|
160
|
+
setHasCreateAction(checkAccess.result);
|
132
161
|
}
|
133
162
|
else {
|
134
|
-
|
135
|
-
|
136
|
-
}
|
137
|
-
if (relatedObjectProperty) {
|
138
|
-
if (validationCriteria) {
|
139
|
-
if (JSON.stringify(validationCriteria).includes('{{{input.')) {
|
140
|
-
setHasCreateAction(checkAccess.result);
|
141
|
-
}
|
142
|
-
else {
|
143
|
-
const criteria = sift(validationCriteria);
|
144
|
-
setHasCreateAction(criteria(instance) && checkAccess.result);
|
145
|
-
}
|
146
|
-
}
|
147
|
-
else {
|
148
|
-
setHasCreateAction(checkAccess.result);
|
149
|
-
}
|
163
|
+
const validate = sift(criteria);
|
164
|
+
setHasCreateAction(validate(instance) && checkAccess.result);
|
150
165
|
}
|
151
166
|
}
|
152
167
|
else {
|
@@ -156,24 +171,24 @@ const RepeatableField = (props) => {
|
|
156
171
|
}
|
157
172
|
};
|
158
173
|
useEffect(() => {
|
159
|
-
(() =>
|
174
|
+
(async () => {
|
160
175
|
try {
|
161
|
-
const users =
|
176
|
+
const users = await apiServices.get(getPrefixedUrl(`/users`));
|
162
177
|
setUsers(users);
|
163
178
|
}
|
164
179
|
catch (error) {
|
165
180
|
console.error(error);
|
166
181
|
}
|
167
|
-
})
|
182
|
+
})();
|
168
183
|
}, [apiServices]);
|
169
184
|
useEffect(() => {
|
170
185
|
fetchRelatedInstances();
|
171
186
|
}, [fetchRelatedInstances, reloadOnErrorTrigger, instance]);
|
172
187
|
useEffect(() => {
|
173
|
-
if (relatedObject
|
188
|
+
if (relatedObject?.rootObjectId) {
|
174
189
|
const callback = () => fetchRelatedInstances();
|
175
|
-
instanceChanges
|
176
|
-
return () => instanceChanges
|
190
|
+
instanceChanges?.subscribe(relatedObject?.rootObjectId, callback);
|
191
|
+
return () => instanceChanges?.unsubscribe(relatedObject?.rootObjectId, callback);
|
177
192
|
}
|
178
193
|
}, [instanceChanges, relatedObject]);
|
179
194
|
const deleteRow = (id) => {
|
@@ -207,8 +222,7 @@ const RepeatableField = (props) => {
|
|
207
222
|
},
|
208
223
|
'min-width': '44px',
|
209
224
|
}, variant: "text", onClick: () => setReloadOnErrorTrigger((prevState) => !prevState) }, "Retry")));
|
210
|
-
const save = (actionType, input, instanceId, setSubmitting) =>
|
211
|
-
var _d, _e, _f, _g, _h, _j;
|
225
|
+
const save = async (actionType, input, instanceId, setSubmitting) => {
|
212
226
|
setSubmitting && setSubmitting(true);
|
213
227
|
// date-time fields are stored in the database in ISO format so convert all
|
214
228
|
// LocalDateTime objects to ISO format.
|
@@ -220,13 +234,13 @@ const RepeatableField = (props) => {
|
|
220
234
|
let isSuccessful = false;
|
221
235
|
let error;
|
222
236
|
if (actionType === 'create') {
|
223
|
-
const updatedInput =
|
237
|
+
const updatedInput = { ...input, [property?.relatedPropertyId]: { id: instance?.id } };
|
224
238
|
try {
|
225
|
-
const instance =
|
239
|
+
const instance = await apiServices.post(getPrefixedUrl(`/objects/${property.objectId}/instances/actions`), {
|
226
240
|
actionId: DEFAULT_CREATE_ACTION,
|
227
241
|
input: updatedInput,
|
228
242
|
});
|
229
|
-
const hasAccess =
|
243
|
+
const hasAccess = property?.relatedPropertyId && property.relatedPropertyId in instance;
|
230
244
|
hasAccess && setRelatedInstances([...relatedInstances, instance]);
|
231
245
|
setSubmitting && setSubmitting(false);
|
232
246
|
// clear out dialog
|
@@ -242,23 +256,25 @@ const RepeatableField = (props) => {
|
|
242
256
|
isError: true,
|
243
257
|
});
|
244
258
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
245
|
-
error =
|
259
|
+
error = err.response?.data?.error;
|
246
260
|
setSubmitting && setSubmitting(false);
|
247
261
|
}
|
248
262
|
}
|
249
263
|
else {
|
250
|
-
const relatedObjectId = relatedObject
|
264
|
+
const relatedObjectId = relatedObject?.id;
|
251
265
|
try {
|
252
|
-
|
266
|
+
await apiServices.post(getPrefixedUrl(`/objects/${relatedObjectId}/instances/${instanceId}/actions`), {
|
253
267
|
actionId: `_${actionType}`,
|
254
|
-
input: pick(input,
|
268
|
+
input: pick(input, relatedObject?.properties
|
269
|
+
?.filter((property) => !property.formula && property.type !== 'collection')
|
270
|
+
.map((property) => property.id) ?? []),
|
255
271
|
});
|
256
272
|
if (actionType === 'delete') {
|
257
273
|
setRelatedInstances((prevInstances) => prevInstances.filter((instance) => instance.id !== instanceId));
|
258
274
|
setSubmitting && setSubmitting(false);
|
259
275
|
}
|
260
276
|
else {
|
261
|
-
setRelatedInstances((prevInstances) => prevInstances.map((i) => (i.id ===
|
277
|
+
setRelatedInstances((prevInstances) => prevInstances.map((i) => (i.id === instance?.id ? instance : i)));
|
262
278
|
setSubmitting && setSubmitting(false);
|
263
279
|
}
|
264
280
|
// clear out dialog
|
@@ -274,27 +290,30 @@ const RepeatableField = (props) => {
|
|
274
290
|
isError: true,
|
275
291
|
});
|
276
292
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
277
|
-
error =
|
293
|
+
error = err.response?.data?.error;
|
278
294
|
}
|
279
295
|
}
|
280
296
|
return { isSuccessful, error };
|
281
|
-
}
|
297
|
+
};
|
282
298
|
const retrieveViewLayout = () => {
|
283
|
-
var _a, _b, _c, _d;
|
284
299
|
let properties = [];
|
285
|
-
if (
|
300
|
+
if (tableViewLayout?.properties?.length) {
|
286
301
|
for (const prop of tableViewLayout.properties) {
|
287
302
|
const propertyId = prop.id.split('.')[0];
|
288
|
-
const property =
|
303
|
+
const property = relatedObject?.properties?.find((p) => p.id === propertyId);
|
289
304
|
if (property) {
|
290
305
|
if ((property.type === 'object' && property.id !== property.relatedPropertyId) ||
|
291
306
|
property.type === 'address' ||
|
292
307
|
property.type === 'user') {
|
293
|
-
properties.push(
|
308
|
+
properties.push({
|
309
|
+
...property,
|
310
|
+
id: ['user', 'object'].includes(property.type) && !prop.id.endsWith('.name')
|
294
311
|
? `${prop.id}.name`
|
295
|
-
: prop.id,
|
312
|
+
: prop.id,
|
313
|
+
name: property.type === 'address'
|
296
314
|
? `${property.name} - ${startCase(prop.id.split('.')[1])}`
|
297
|
-
: property.name
|
315
|
+
: property.name,
|
316
|
+
});
|
298
317
|
}
|
299
318
|
else {
|
300
319
|
properties.push(property);
|
@@ -304,7 +323,12 @@ const RepeatableField = (props) => {
|
|
304
323
|
}
|
305
324
|
else {
|
306
325
|
properties =
|
307
|
-
|
326
|
+
relatedObject?.properties
|
327
|
+
?.filter((prop) => !['address', 'image', 'collection'].includes(prop.type))
|
328
|
+
.map((prop) => ({
|
329
|
+
...prop,
|
330
|
+
id: prop.type === 'object' || prop.type === 'user' ? `${prop.id}.name` : prop.id,
|
331
|
+
})) ?? [];
|
308
332
|
}
|
309
333
|
return properties;
|
310
334
|
};
|
@@ -342,7 +366,7 @@ const RepeatableField = (props) => {
|
|
342
366
|
React.createElement(Skeleton, null),
|
343
367
|
React.createElement(Skeleton, null))) : (React.createElement(React.Fragment, null,
|
344
368
|
React.createElement(Box, { sx: { padding: '10px 0' } },
|
345
|
-
!
|
369
|
+
!relatedInstances?.length ? (!error ? (React.createElement(Typography, { sx: { color: 'rgb(114 124 132)', fontSize: '14px' } }, "No items added")) : (React.createElement(ErrorComponent, null))) : (React.createElement(TableContainer, { sx: {
|
346
370
|
borderRadius: '6px',
|
347
371
|
border: '1px solid #919EAB3D',
|
348
372
|
boxShadow: 'none',
|
@@ -350,12 +374,11 @@ const RepeatableField = (props) => {
|
|
350
374
|
} },
|
351
375
|
React.createElement(Table, { stickyHeader: true, sx: { minWidth: 650 } },
|
352
376
|
React.createElement(TableHead, { sx: { backgroundColor: '#F4F6F8' } },
|
353
|
-
React.createElement(TableRow, null,
|
354
|
-
columns
|
355
|
-
React.createElement(TableCell, { sx:
|
356
|
-
React.createElement(TableBody, null, relatedInstances
|
357
|
-
columns
|
358
|
-
var _a;
|
377
|
+
React.createElement(TableRow, null,
|
378
|
+
columns?.map((prop) => React.createElement(TableCell, { sx: styles.tableCell }, prop.name)),
|
379
|
+
React.createElement(TableCell, { sx: { ...styles.tableCell, width: '80px' } }))),
|
380
|
+
React.createElement(TableBody, null, relatedInstances?.map((relatedInstance, index) => (React.createElement(TableRow, { key: relatedInstance.id },
|
381
|
+
columns?.map((prop) => {
|
359
382
|
return (React.createElement(TableCell, { sx: { color: '#212B36', fontSize: '16px' } },
|
360
383
|
React.createElement(Typography, { key: prop.id, sx: prop.id === 'name'
|
361
384
|
? {
|
@@ -369,7 +392,7 @@ const RepeatableField = (props) => {
|
|
369
392
|
: undefined },
|
370
393
|
getValue(relatedInstance, prop.id, prop.type),
|
371
394
|
prop.type === 'user' &&
|
372
|
-
|
395
|
+
users?.find((user) => get(relatedInstance, `${prop.id.split('.')[0]}.id`) === user.id)?.status === 'Inactive' && React.createElement("span", null, ' (Inactive)'))));
|
373
396
|
}),
|
374
397
|
canUpdateProperty && (React.createElement(TableCell, { sx: { width: '80px' } },
|
375
398
|
React.createElement(IconButton, { "aria-label": `edit-collection-instance-${index}`, onClick: () => editRow(relatedInstance.id) },
|
@@ -379,9 +402,9 @@ const RepeatableField = (props) => {
|
|
379
402
|
React.createElement(Tooltip, { title: "Delete" },
|
380
403
|
React.createElement(TrashCan, { sx: { ':hover': { color: '#A12723' } } })))))))))))),
|
381
404
|
hasCreateAction && (React.createElement(Button, { variant: "contained", sx: styles.addButton, onClick: addRow }, "Add"))),
|
382
|
-
relatedObject && openDialog && (React.createElement(ActionDialog, { object: relatedObject, open: openDialog, apiServices: apiServices, onClose: () => setOpenDialog(false), instanceInput: dialogType === 'update' ?
|
405
|
+
relatedObject && openDialog && (React.createElement(ActionDialog, { object: relatedObject, open: openDialog, apiServices: apiServices, onClose: () => setOpenDialog(false), instanceInput: dialogType === 'update' ? relatedInstances.find((i) => i.id === selectedRow) ?? {} : {}, handleSubmit: save,
|
383
406
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
384
|
-
objectInputCommonProps: { apiServices }, action:
|
407
|
+
objectInputCommonProps: { apiServices }, action: relatedObject?.actions?.find((a) => a.id ===
|
385
408
|
(dialogType === 'create' ? '_create' : dialogType === 'update' ? '_update' : '_delete')), instanceId: selectedRow, relatedProperty: property, queryAddresses: queryAddresses, user: user })),
|
386
409
|
React.createElement(Snackbar, { open: snackbarError.showAlert, handleClose: () => setSnackbarError({ isError: snackbarError.isError, showAlert: false }), message: snackbarError.message, error: snackbarError.isError })));
|
387
410
|
};
|
@@ -12,11 +12,14 @@ const apiBaseUrl = process.env.REACT_APP_API_ROOT || `${window.location.origin}/
|
|
12
12
|
export class RepeatableFieldComponent extends ReactComponent {
|
13
13
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
14
14
|
constructor(component, options, data) {
|
15
|
-
|
16
|
-
|
15
|
+
super({
|
16
|
+
...component,
|
17
|
+
canUpdateProperty: !component.readOnly,
|
18
|
+
hideLabel: true,
|
19
|
+
}, options, data);
|
17
20
|
this.errorDetails = {};
|
18
21
|
this.criteria = component.validate.criteria;
|
19
|
-
this.updatedCriteria =
|
22
|
+
this.updatedCriteria = cloneDeep(component.validate.criteria) ?? {};
|
20
23
|
}
|
21
24
|
init() {
|
22
25
|
if (this.criteria) {
|
@@ -33,9 +36,8 @@ export class RepeatableFieldComponent extends ReactComponent {
|
|
33
36
|
compKey = inputProp;
|
34
37
|
}
|
35
38
|
this.on(`changed-${compKey}`, () => {
|
36
|
-
var _a;
|
37
39
|
const data = dot.dot(this.root._data);
|
38
|
-
this.updatedCriteria =
|
40
|
+
this.updatedCriteria = cloneDeep(this.criteria) ?? {};
|
39
41
|
for (const inputProp of inputProps) {
|
40
42
|
updateCriteriaInputs(this.updatedCriteria, inputProp, data[inputProp], true);
|
41
43
|
}
|
@@ -49,7 +51,7 @@ export class RepeatableFieldComponent extends ReactComponent {
|
|
49
51
|
const inputId = `${this.component.id}-input`;
|
50
52
|
return ReactDOM.render(React.createElement("div", null, !this.component.hidden ? (React.createElement(ApiBaseUrlProvider, { url: apiBaseUrl },
|
51
53
|
React.createElement(NotificationProvider, null,
|
52
|
-
React.createElement(FormComponentWrapper,
|
54
|
+
React.createElement(FormComponentWrapper, { ...this.component, inputId: inputId, viewOnly: !this.component.canUpdateProperty }, this.component.property.manyToManyPropertyId ? (React.createElement(DropdownRepeatableField, { id: inputId, property: this.component.property, instance: this.component.instance, apiServices: this.component.apiServices, criteria: this.updatedCriteria, readOnly: !this.component.canUpdateProperty, initialMiddleObjectInstances: this.component.initialMiddleObjectInstances, middleObject: this.component.middleObject, getMiddleObjectInstances: this.component.getMiddleObjectInstances, fieldHeight: this.component.fieldHeight, viewLayout: this.component.viewLayout })) : (React.createElement(RepeatableField, { ...this.component })))))) : null), element);
|
53
55
|
}
|
54
56
|
detachReact(element) {
|
55
57
|
ReactDOM.unmountComponentAtNode(element);
|
package/dist/published/components/custom/Form/FormComponents/UserComponent/UserComponent.d.ts
CHANGED
@@ -6,7 +6,9 @@ export declare class UserComponent extends ReactComponent {
|
|
6
6
|
[x: string]: any;
|
7
7
|
static schema: any;
|
8
8
|
errorDetails: any;
|
9
|
-
component: BaseFormComponentProps
|
9
|
+
component: BaseFormComponentProps & {
|
10
|
+
initialValue?: string;
|
11
|
+
};
|
10
12
|
componentRoot?: Root;
|
11
13
|
criteria: Record<string, unknown> | undefined;
|
12
14
|
updatedCriteria: Record<string, unknown>;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
2
1
|
import { ReactComponent } from '@formio/react';
|
3
2
|
import { cloneDeep, isEmpty } from 'lodash';
|
4
3
|
import React from 'react';
|
@@ -8,21 +7,25 @@ import { isPropertyVisible, transformToWhere } from '../../utils';
|
|
8
7
|
import { UserProperty } from './UserProperty';
|
9
8
|
export class UserComponent extends ReactComponent {
|
10
9
|
constructor(component, options, data) {
|
11
|
-
|
12
|
-
|
10
|
+
super({
|
11
|
+
...component,
|
12
|
+
canUpdateProperty: !component.readOnly,
|
13
|
+
hideLabel: true,
|
14
|
+
}, options, data);
|
13
15
|
this.handleChangeUserProperty = (value) => {
|
16
|
+
delete this.errorDetails['api-error'];
|
14
17
|
// set the value on the form instance at this.root.data
|
15
18
|
const updatedValue = value ? { name: value.label, id: value.value } : '';
|
16
19
|
this.setValue(updatedValue);
|
17
20
|
// update the value in the component instance
|
18
|
-
this.updateValue(updatedValue
|
21
|
+
this.updateValue(updatedValue ?? {}, { modified: true });
|
19
22
|
this.handleValidation();
|
20
23
|
this.attach(this.element);
|
21
24
|
this.component.autoSave && this.component.autoSave(value);
|
22
25
|
};
|
23
26
|
this.errorDetails = {};
|
24
27
|
this.criteria = component.validate.criteria;
|
25
|
-
this.updatedCriteria =
|
28
|
+
this.updatedCriteria = cloneDeep(component.validate.criteria) ?? {};
|
26
29
|
this.handleChangeUserProperty = this.handleChangeUserProperty.bind(this);
|
27
30
|
}
|
28
31
|
init() {
|
@@ -45,6 +48,42 @@ export class UserComponent extends ReactComponent {
|
|
45
48
|
}
|
46
49
|
}
|
47
50
|
});
|
51
|
+
if (this.component.initialValue && /^{{.*}}$/.test(this.component.initialValue)) {
|
52
|
+
const regex = /^{{input\.(?<relatedObjectProperty>[a-zA-Z][a-zA-Z0-9_]*)\.(?<nestedProperty>[a-zA-Z][a-zA-Z0-9_]*)}}$/;
|
53
|
+
const groups = regex.exec(this.component.initialValue)?.groups;
|
54
|
+
if (groups?.relatedObjectProperty && groups?.nestedProperty) {
|
55
|
+
this.on(`changed-${groups.relatedObjectProperty}`, (value) => {
|
56
|
+
if (value) {
|
57
|
+
this.setValue(value?.[groups.nestedProperty]);
|
58
|
+
this.updateValue(value?.[groups.nestedProperty], { modified: true });
|
59
|
+
this.attach(this.element);
|
60
|
+
}
|
61
|
+
});
|
62
|
+
}
|
63
|
+
}
|
64
|
+
this.on(`api-error`, (details) => {
|
65
|
+
const error = details.find((detail) => detail.code === 'errorMessage' && detail.path.replace('/', '') === this.component.key);
|
66
|
+
if (error) {
|
67
|
+
if (!this.root.customErrors.find((err) => err.formattedKeyOrPath === this.component.key && err.message === error.message)) {
|
68
|
+
this.root.customErrors = [
|
69
|
+
...this.root.customErrors,
|
70
|
+
{
|
71
|
+
...error,
|
72
|
+
code: 'api-error',
|
73
|
+
component: this.component,
|
74
|
+
formattedKeyOrPath: this.component.key,
|
75
|
+
},
|
76
|
+
];
|
77
|
+
}
|
78
|
+
this.errorDetails['api-error'] = error?.message;
|
79
|
+
}
|
80
|
+
else {
|
81
|
+
this.root.customErrors = this.root.customErrors.filter((item) => item.formattedKeyOrPath !== this.component.key);
|
82
|
+
delete this.errorDetails['api-error'];
|
83
|
+
}
|
84
|
+
this.attach(this.element);
|
85
|
+
this.attachReact(this.element);
|
86
|
+
});
|
48
87
|
}
|
49
88
|
clearErrors() {
|
50
89
|
this.errorDetails = {};
|
@@ -68,10 +107,9 @@ export class UserComponent extends ReactComponent {
|
|
68
107
|
* Synchronizes out-of-the-box formio errors with this field's errorDetails object
|
69
108
|
*/
|
70
109
|
manageFormErrors() {
|
71
|
-
|
72
|
-
const outOfTheBoxError = (_a = this.root.errors.find((error) => {
|
110
|
+
const outOfTheBoxError = this.root.errors.find((error) => {
|
73
111
|
return error.component.key === this.component.key;
|
74
|
-
})
|
112
|
+
})?.message;
|
75
113
|
// add OoB formio error to errorDetails object to show under field
|
76
114
|
if (outOfTheBoxError) {
|
77
115
|
this.errorDetails['rootError'] = outOfTheBoxError;
|
@@ -85,15 +123,20 @@ export class UserComponent extends ReactComponent {
|
|
85
123
|
this.element && this.attach(this.element);
|
86
124
|
}
|
87
125
|
attachReact(element) {
|
88
|
-
|
89
|
-
|
126
|
+
const updatedComponent = {
|
127
|
+
...this.component,
|
128
|
+
instance: {
|
129
|
+
...this.component.instance,
|
130
|
+
[this.component.key]: isEmpty(this.dataValue) ? null : this.dataValue,
|
131
|
+
},
|
132
|
+
};
|
90
133
|
if (!this.componentRoot) {
|
91
134
|
this.componentRoot = createRoot(element, { onRecoverableError: console.error });
|
92
135
|
}
|
93
136
|
// FormIO uses id for an enclosing div, so we need to give the input field a different id.
|
94
137
|
const inputId = `${this.component.id}-input`;
|
95
138
|
return this.componentRoot.render(React.createElement("div", null,
|
96
|
-
React.createElement(FormComponentWrapper,
|
97
|
-
React.createElement(UserProperty,
|
139
|
+
React.createElement(FormComponentWrapper, { ...updatedComponent, inputId: inputId, errorMessage: this.errorMessages() },
|
140
|
+
React.createElement(UserProperty, { ...updatedComponent, id: inputId, value: this.dataValue ?? '', handleChangeUserProperty: this.handleChangeUserProperty, error: this.hasErrors(), filter: this.criteria ? { where: transformToWhere(this.updatedCriteria) } : undefined }))));
|
98
141
|
}
|
99
142
|
}
|