@evoke-platform/ui-components 1.0.0-dev.216 → 1.0.0-dev.218
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/LICENSE +1 -1
- package/colors.ts +1 -1
- 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/Accordion/index.d.ts +2 -2
- package/dist/published/components/core/Accordion/index.js +2 -2
- package/dist/published/components/core/Alert/Alert.js +3 -3
- 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.d.ts +2 -2
- package/dist/published/components/core/Autocomplete/Autocomplete.js +2 -2
- package/dist/published/components/core/Autocomplete/Autocomplete.test.js +1 -1
- package/dist/published/components/core/Avatar/Avatar.js +1 -1
- 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 +3 -3
- package/dist/published/components/core/DateTimePicker/DateTimePicker.js +3 -3
- package/dist/published/components/core/Dialog/Dialog.js +1 -1
- package/dist/published/components/core/Dialog/DialogActions/DialogActions.d.ts +2 -2
- package/dist/published/components/core/Dialog/DialogActions/DialogActions.js +1 -1
- 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/Dialog/index.d.ts +2 -2
- package/dist/published/components/core/Dialog/index.js +2 -2
- 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 +2 -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/FormElements/index.d.ts +3 -3
- package/dist/published/components/core/FormElements/index.js +3 -3
- 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 +4 -4
- 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/Menu/index.d.ts +1 -1
- package/dist/published/components/core/Menu/index.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 +1 -1
- package/dist/published/components/core/Skeleton/Skeleton.js +1 -1
- package/dist/published/components/core/Snackbar/Snackbar.d.ts +2 -2
- package/dist/published/components/core/Snackbar/Snackbar.js +1 -1
- package/dist/published/components/core/StaticDatePicker/StaticDatePicker.js +2 -2
- 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/Stepper/index.d.ts +5 -5
- package/dist/published/components/core/Stepper/index.js +5 -5
- 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/Tabs/index.d.ts +2 -2
- package/dist/published/components/core/Tabs/index.js +2 -2
- package/dist/published/components/core/TextField/TextField.js +1 -1
- package/dist/published/components/core/TextField/TextField.test.js +1 -1
- 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 +1 -1
- package/dist/published/components/core/Typography/index.js +1 -1
- package/dist/published/components/core/index.d.ts +23 -23
- package/dist/published/components/core/index.js +22 -22
- package/dist/published/components/custom/BuilderGrid/BuilderGrid.d.ts +3 -3
- package/dist/published/components/custom/BuilderGrid/BuilderGrid.js +1 -1
- package/dist/published/components/custom/BuilderGrid/BuilderGridToolbar.d.ts +2 -2
- package/dist/published/components/custom/BuilderGrid/ToolbarActions.d.ts +2 -2
- package/dist/published/components/custom/CriteriaBuilder/CriteriaBuilder.d.ts +3 -3
- package/dist/published/components/custom/CriteriaBuilder/CriteriaBuilder.js +2 -2
- package/dist/published/components/custom/CriteriaBuilder/ValueEditor.d.ts +1 -1
- package/dist/published/components/custom/CriteriaBuilder/ValueEditor.js +3 -3
- package/dist/published/components/custom/DataGrid/DataGrid.d.ts +1 -1
- package/dist/published/components/custom/DataGrid/DataGrid.js +4 -5
- package/dist/published/components/custom/DataGrid/DateTimeCustomOperator.js +1 -1
- package/dist/published/components/custom/DataGrid/Toolbar.d.ts +1 -1
- package/dist/published/components/custom/DataGrid/Toolbar.js +3 -3
- package/dist/published/components/custom/ErrorComponent/ErrorComponent.d.ts +2 -2
- package/dist/published/components/custom/ErrorComponent/ErrorComponent.js +2 -2
- package/dist/published/components/custom/Form/Common/Form.d.ts +38 -0
- package/dist/published/components/custom/Form/Common/Form.js +413 -0
- package/dist/published/components/custom/Form/Common/FormComponentWrapper.d.ts +26 -0
- package/dist/published/components/custom/Form/Common/FormComponentWrapper.js +79 -0
- package/dist/published/components/custom/Form/Common/index.d.ts +2 -0
- package/dist/published/components/custom/Form/Common/index.js +2 -0
- package/dist/published/components/custom/Form/FormComponents/ButtonComponent.d.ts +37 -0
- package/dist/published/components/custom/Form/FormComponents/ButtonComponent.js +150 -0
- package/dist/published/components/custom/Form/FormComponents/DocumentComponent/Document.d.ts +17 -0
- package/dist/published/components/custom/Form/FormComponents/DocumentComponent/Document.js +80 -0
- package/dist/published/components/custom/Form/FormComponents/DocumentComponent/DocumentComponent.d.ts +23 -0
- package/dist/published/components/custom/Form/FormComponents/DocumentComponent/DocumentComponent.js +154 -0
- package/dist/published/components/custom/Form/FormComponents/DocumentComponent/DocumentList.d.ts +15 -0
- package/dist/published/components/custom/Form/FormComponents/DocumentComponent/DocumentList.js +172 -0
- package/dist/published/components/custom/Form/FormComponents/FormFieldComponent.d.ts +41 -0
- package/dist/published/components/custom/Form/FormComponents/FormFieldComponent.js +409 -0
- package/dist/published/components/custom/Form/FormComponents/ImageComponent/Image.d.ts +15 -0
- package/dist/published/components/custom/Form/FormComponents/ImageComponent/Image.js +111 -0
- package/dist/published/components/custom/Form/FormComponents/ImageComponent/ImageComponent.d.ts +23 -0
- package/dist/published/components/custom/Form/FormComponents/ImageComponent/ImageComponent.js +112 -0
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/InstanceLookup.d.ts +20 -0
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/InstanceLookup.js +229 -0
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectComponent.d.ts +34 -0
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectComponent.js +150 -0
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectPropertyInput.d.ts +3 -0
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectPropertyInput.js +306 -0
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/RelatedObjectInstance.d.ts +24 -0
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/RelatedObjectInstance.js +126 -0
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ActionDialog.d.ts +21 -0
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ActionDialog.js +96 -0
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ManyToMany/DropdownRepeatableField.d.ts +15 -0
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ManyToMany/DropdownRepeatableField.js +158 -0
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ManyToMany/DropdownRepeatableFieldInput.d.ts +39 -0
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/ManyToMany/DropdownRepeatableFieldInput.js +89 -0
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/RepeatableField.d.ts +12 -0
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/RepeatableField.js +369 -0
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/RepeatableFieldComponent.d.ts +20 -0
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/RepeatableFieldComponent.js +57 -0
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserComponent.d.ts +26 -0
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserComponent.js +99 -0
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserProperty.d.ts +23 -0
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserProperty.js +115 -0
- package/dist/published/components/custom/Form/FormComponents/ViewOnlyComponent.d.ts +20 -0
- package/dist/published/components/custom/Form/FormComponents/ViewOnlyComponent.js +83 -0
- package/dist/published/components/custom/Form/FormComponents/index.d.ts +8 -0
- package/dist/published/components/custom/Form/FormComponents/index.js +8 -0
- package/dist/published/components/custom/Form/index.d.ts +3 -0
- package/dist/published/components/custom/Form/index.js +3 -0
- package/dist/published/components/custom/Form/types.d.ts +109 -0
- package/dist/published/components/custom/Form/types.js +1 -0
- package/dist/published/components/custom/Form/utils.d.ts +45 -0
- package/dist/published/components/custom/Form/utils.js +1036 -0
- package/dist/published/components/custom/FormField/AddressFieldComponent/AddressFieldComponent.test.js +1 -1
- package/dist/published/components/custom/FormField/AddressFieldComponent/addressFieldComponent.js +1 -1
- package/dist/published/components/custom/FormField/BooleanSelect/BooleanSelect.test.js +1 -1
- package/dist/published/components/custom/FormField/DatePickerSelect/DatePickerSelect.test.js +3 -3
- package/dist/published/components/custom/FormField/DateTimePickerSelect/DateTimePickerSelect.js +2 -2
- package/dist/published/components/custom/FormField/DateTimePickerSelect/DateTimePickerSelect.test.js +4 -4
- package/dist/published/components/custom/FormField/FormField.d.ts +4 -4
- package/dist/published/components/custom/FormField/FormField.js +1 -1
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js +1 -1
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.test.js +1 -1
- package/dist/published/components/custom/FormField/Select/Select.test.js +1 -1
- package/dist/published/components/custom/FormField/TimePickerSelect/TimePickerSelect.js +4 -4
- package/dist/published/components/custom/Menubar/Menubar.js +1 -1
- package/dist/published/components/custom/Menubar/Menubar.test.js +2 -2
- package/dist/published/components/custom/MultiSelect/MultiSelect.js +7 -7
- package/dist/published/components/custom/MultiSelect/SortableItem.js +2 -2
- package/dist/published/components/custom/RepeatableField/RepeatableField.js +4 -4
- package/dist/published/components/custom/index.d.ts +1 -0
- package/dist/published/components/custom/index.js +1 -0
- package/dist/published/components/custom/util.js +1 -1
- package/dist/published/components/layout/Box/Box.d.ts +2 -2
- 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/TrashCan.d.ts +1 -1
- package/dist/published/icons/custom/TrashCan.js +1 -1
- package/dist/published/icons/custom/index.d.ts +1 -1
- package/dist/published/icons/custom/index.js +1 -1
- package/dist/published/index.d.ts +3 -3
- package/dist/published/index.js +2 -2
- package/dist/published/stories/Accordion.stories.d.ts +1 -1
- package/dist/published/stories/Accordion.stories.js +2 -2
- package/dist/published/stories/Alert.stories.d.ts +1 -1
- package/dist/published/stories/AlertTitle.stories.d.ts +1 -1
- package/dist/published/stories/Appbar.stories.d.ts +1 -1
- package/dist/published/stories/Appbar.stories.js +2 -2
- package/dist/published/stories/Autocomplete.stories.d.ts +1 -1
- package/dist/published/stories/Autocomplete.stories.js +3 -3
- package/dist/published/stories/Avatar.stories.d.ts +1 -1
- package/dist/published/stories/Backdrop.stories.d.ts +1 -1
- package/dist/published/stories/Backdrop.stories.js +3 -3
- package/dist/published/stories/Badge.stories.d.ts +1 -1
- package/dist/published/stories/Badge.stories.js +1 -1
- package/dist/published/stories/Box.stories.d.ts +1 -1
- package/dist/published/stories/Breadcrumbs.stories.d.ts +1 -1
- package/dist/published/stories/Button.stories.d.ts +1 -1
- package/dist/published/stories/ButtonGroup.stories.d.ts +1 -1
- package/dist/published/stories/Card.stories.d.ts +1 -1
- package/dist/published/stories/Card.stories.js +1 -1
- package/dist/published/stories/Checkbox.stories.d.ts +1 -1
- package/dist/published/stories/Chip.stories.d.ts +1 -1
- package/dist/published/stories/CircularProgress.stories.d.ts +1 -1
- package/dist/published/stories/Collapse.stories.d.ts +1 -1
- package/dist/published/stories/Collapse.stories.js +1 -1
- package/dist/published/stories/Container.stories.d.ts +1 -1
- package/dist/published/stories/Container.stories.js +3 -3
- package/dist/published/stories/DataGrid.stories.d.ts +1 -1
- package/dist/published/stories/DataGrid.stories.js +1 -1
- package/dist/published/stories/DatePicker.stories.d.ts +1 -1
- package/dist/published/stories/Dialog.stories.d.ts +1 -1
- package/dist/published/stories/Dialog.stories.js +3 -3
- package/dist/published/stories/Divider.stories.d.ts +1 -1
- package/dist/published/stories/Drawer.stories.d.ts +1 -1
- package/dist/published/stories/Drawer.stories.js +4 -4
- package/dist/published/stories/FormControl.stories.d.ts +1 -1
- package/dist/published/stories/FormControl.stories.js +1 -1
- package/dist/published/stories/FormControlLabel.stories.d.ts +1 -1
- package/dist/published/stories/FormGroup.stories.d.ts +1 -1
- package/dist/published/stories/FormHelperText.stories.d.ts +1 -1
- package/dist/published/stories/FormLabel.stories.d.ts +1 -1
- package/dist/published/stories/FormLabel.stories.js +2 -2
- package/dist/published/stories/Grid.stories.d.ts +1 -1
- package/dist/published/stories/IconButton.stories.d.ts +1 -1
- package/dist/published/stories/IconButton.stories.js +1 -1
- package/dist/published/stories/LinearProgress.stories.d.ts +1 -1
- package/dist/published/stories/Link.stories.d.ts +1 -1
- package/dist/published/stories/List.stories.d.ts +1 -1
- package/dist/published/stories/List.stories.js +3 -3
- package/dist/published/stories/Menu.stories.d.ts +1 -1
- package/dist/published/stories/Menu.stories.js +3 -3
- package/dist/published/stories/MenuBar.stories.d.ts +1 -1
- package/dist/published/stories/MenuBar.stories.js +1 -1
- package/dist/published/stories/MultiSelect.stories.d.ts +1 -1
- package/dist/published/stories/MultiSelect.stories.js +1 -1
- package/dist/published/stories/Palette.stories.d.ts +1 -1
- package/dist/published/stories/Palette.stories.js +1 -1
- package/dist/published/stories/Paper.stories.d.ts +1 -1
- package/dist/published/stories/Paper.stories.js +1 -1
- package/dist/published/stories/RadioGroup.stories.d.ts +1 -1
- package/dist/published/stories/RadioGroup.stories.js +1 -1
- package/dist/published/stories/RepeatableField.stories.d.ts +1 -1
- package/dist/published/stories/RepeatableField.stories.js +1 -1
- package/dist/published/stories/Skeleton.stories.d.ts +1 -1
- package/dist/published/stories/Snackbar.stories.d.ts +1 -1
- package/dist/published/stories/Snackbar.stories.js +3 -3
- package/dist/published/stories/Stack.stories.d.ts +1 -1
- package/dist/published/stories/StaticDatePicker.stories.d.ts +1 -1
- package/dist/published/stories/Stepper.stories.d.ts +2 -2
- package/dist/published/stories/Stepper.stories.js +6 -6
- package/dist/published/stories/Switch.stories.d.ts +1 -1
- package/dist/published/stories/Table.stories.d.ts +1 -1
- package/dist/published/stories/Table.stories.js +1 -1
- package/dist/published/stories/Tabs.stories.d.ts +1 -1
- package/dist/published/stories/TextField.stories.d.ts +1 -1
- package/dist/published/stories/TimePicker.stories.d.ts +1 -1
- package/dist/published/stories/TimePicker.stories.js +1 -1
- package/dist/published/stories/TimePickerSelect.stories.d.ts +1 -1
- package/dist/published/stories/ToggleButton.stories.d.ts +1 -1
- package/dist/published/stories/ToggleButton.stories.js +3 -3
- package/dist/published/stories/Typography.stories.d.ts +1 -1
- package/dist/published/stories/Typography.stories.js +1 -1
- package/dist/published/styles/form-component.css +152 -0
- package/dist/published/theme/UIThemeProvider.d.ts +2 -2
- package/dist/published/theme/UIThemeProvider.js +1 -1
- package/dist/published/util/date.d.ts +1 -1
- package/dist/published/util/date.js +1 -1
- package/icons.ts +1 -1
- package/package.json +21 -7
@@ -0,0 +1,115 @@
|
|
1
|
+
import { ExpandMore } from '@mui/icons-material';
|
2
|
+
import React, { useEffect, useState } from 'react';
|
3
|
+
import { Autocomplete, Paper, TextField, Typography } from '../../../../core';
|
4
|
+
import { getPrefixedUrl } from '../../utils';
|
5
|
+
export const UserProperty = (props) => {
|
6
|
+
const { id, property, apiServices, handleChangeUserProperty, error, filter, value, user, fieldHeight } = props;
|
7
|
+
const [loadingOptions, setLoadingOptions] = useState(false);
|
8
|
+
const [options, setOptions] = useState([]);
|
9
|
+
const [openOptions, setOpenOptions] = useState(false);
|
10
|
+
const [users, setUsers] = useState();
|
11
|
+
const [userValue, setUserValue] = useState();
|
12
|
+
useEffect(() => {
|
13
|
+
if (value === '$_CURRENT' && (user === null || user === void 0 ? void 0 : user.id)) {
|
14
|
+
const loggedInUser = users === null || users === void 0 ? void 0 : users.find((u) => u.id === user.id);
|
15
|
+
if (loggedInUser) {
|
16
|
+
setUserValue({ label: loggedInUser.name, value: loggedInUser.id });
|
17
|
+
handleChangeUserProperty({ label: loggedInUser.name, value: loggedInUser.id });
|
18
|
+
}
|
19
|
+
}
|
20
|
+
else {
|
21
|
+
if (value && typeof value == 'object' && 'name' in value && 'id' in value) {
|
22
|
+
setUserValue({ label: value.name, value: value.id });
|
23
|
+
}
|
24
|
+
else {
|
25
|
+
setUserValue(undefined);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}, [users, value]);
|
29
|
+
useEffect(() => {
|
30
|
+
if (property.type === 'user') {
|
31
|
+
setLoadingOptions(true);
|
32
|
+
apiServices.get(getPrefixedUrl(`/users`), (error, userList) => {
|
33
|
+
setUsers(userList);
|
34
|
+
setOptions((userList !== null && userList !== void 0 ? userList : []).map((user) => ({ label: user.name, value: user.id })));
|
35
|
+
setLoadingOptions(false);
|
36
|
+
});
|
37
|
+
}
|
38
|
+
}, [property, filter]);
|
39
|
+
return (options && (React.createElement(React.Fragment, null,
|
40
|
+
React.createElement(Autocomplete, { id: id, fullWidth: true, open: openOptions, popupIcon: userValue ? '' : React.createElement(ExpandMore, null), PaperComponent: ({ children }) => {
|
41
|
+
return (React.createElement(Paper, { sx: {
|
42
|
+
borderRadius: '12px',
|
43
|
+
boxShadow: '0px 24px 48px 0px rgba(145, 158, 171, 0.2)',
|
44
|
+
'& .MuiAutocomplete-listbox': {
|
45
|
+
maxHeight: '25vh',
|
46
|
+
},
|
47
|
+
'& .MuiAutocomplete-noOptions': {
|
48
|
+
fontFamily: 'sans-serif',
|
49
|
+
fontSize: '14px',
|
50
|
+
paddingLeft: '24px',
|
51
|
+
color: 'rgba(145, 158, 171, 1)',
|
52
|
+
},
|
53
|
+
'& .MuiAutocomplete-loading': {
|
54
|
+
fontFamily: 'sans-serif',
|
55
|
+
fontSize: '14px',
|
56
|
+
paddingLeft: '24px',
|
57
|
+
color: 'rgba(145, 158, 171, 1)',
|
58
|
+
},
|
59
|
+
} }, children));
|
60
|
+
}, sx: {
|
61
|
+
'& button.MuiButtonBase-root': Object.assign({}, (!loadingOptions && value
|
62
|
+
? {
|
63
|
+
visibility: 'visible',
|
64
|
+
}
|
65
|
+
: {})),
|
66
|
+
}, noOptionsText: 'No options available', renderOption: (props, option) => {
|
67
|
+
var _a;
|
68
|
+
return (React.createElement("li", Object.assign({}, props, { key: option.id }),
|
69
|
+
React.createElement(Typography, { sx: { marginLeft: '8px', fontSize: '14px' } },
|
70
|
+
option.label,
|
71
|
+
" ",
|
72
|
+
'',
|
73
|
+
((_a = users === null || users === void 0 ? void 0 : users.find((user) => option.value === user.id)) === null || _a === void 0 ? void 0 : _a.status) === 'Inactive' ? (React.createElement("span", null, "(Inactive)")) : (''))));
|
74
|
+
}, onOpen: () => {
|
75
|
+
setOpenOptions(true);
|
76
|
+
}, onClose: () => setOpenOptions(false), value: userValue !== null && userValue !== void 0 ? userValue : '', options: options, getOptionLabel: (option) => {
|
77
|
+
var _a, _b, _c, _d;
|
78
|
+
if (typeof option === 'string') {
|
79
|
+
return (_b = (_a = options.find((o) => o.value === option)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : '';
|
80
|
+
}
|
81
|
+
else {
|
82
|
+
{
|
83
|
+
if (((_c = users === null || users === void 0 ? void 0 : users.find((user) => option.value === user.id)) === null || _c === void 0 ? void 0 : _c.status) === 'Inactive') {
|
84
|
+
return option.label + ' (Inactive)';
|
85
|
+
}
|
86
|
+
else {
|
87
|
+
return (_d = option.label) !== null && _d !== void 0 ? _d : '';
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}, onKeyDownCapture: (e) => {
|
92
|
+
if (value) {
|
93
|
+
e.preventDefault();
|
94
|
+
}
|
95
|
+
}, loading: loadingOptions, isOptionEqualToValue: (option, value) => {
|
96
|
+
if (typeof value === 'string') {
|
97
|
+
return option.value === value;
|
98
|
+
}
|
99
|
+
return option.value === (value === null || value === void 0 ? void 0 : value.value);
|
100
|
+
}, onChange: (event, value) => {
|
101
|
+
handleChangeUserProperty(value);
|
102
|
+
}, selectOnFocus: false, renderInput: (params) => (React.createElement(TextField, Object.assign({}, params, { placeholder: 'Select', sx: Object.assign({}, (!loadingOptions && value
|
103
|
+
? {
|
104
|
+
'.MuiOutlinedInput-root': {
|
105
|
+
background: 'white',
|
106
|
+
border: 'auto',
|
107
|
+
},
|
108
|
+
'& fieldset': { borderColor: 'auto' },
|
109
|
+
'&:hover .MuiOutlinedInput-notchedOutline': {
|
110
|
+
border: 'auto',
|
111
|
+
},
|
112
|
+
caretColor: 'white',
|
113
|
+
}
|
114
|
+
: {})), size: fieldHeight !== null && fieldHeight !== void 0 ? fieldHeight : 'medium' }))), error: error }))));
|
115
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { ReactComponent } from '@formio/react';
|
2
|
+
import { Root } from 'react-dom/client';
|
3
|
+
import { BaseFormComponentProps } from '../types';
|
4
|
+
export declare class ViewOnlyComponent extends ReactComponent {
|
5
|
+
[x: string]: any;
|
6
|
+
static schema: any;
|
7
|
+
componentRoot?: Root;
|
8
|
+
component: BaseFormComponentProps;
|
9
|
+
/**
|
10
|
+
* Called when the component has been instantiated. This is useful to define
|
11
|
+
* default instance variable values.
|
12
|
+
*
|
13
|
+
* @param component - The JSON representation of the component created.
|
14
|
+
* @param options - The global options for the renderer
|
15
|
+
* @param data - The contextual data object (model) used for this component.
|
16
|
+
*/
|
17
|
+
constructor(component: BaseFormComponentProps, options: any, data: any);
|
18
|
+
showValue(value: unknown): {} | undefined;
|
19
|
+
attachReact(element: Element): void;
|
20
|
+
}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import { ReactComponent } from '@formio/react';
|
2
|
+
import { get, isEmpty } from 'lodash';
|
3
|
+
import { DateTime } from 'luxon';
|
4
|
+
import React from 'react';
|
5
|
+
import ReactDOM from 'react-dom';
|
6
|
+
import { createRoot } from 'react-dom/client';
|
7
|
+
import { Link, Typography } from '../../../core';
|
8
|
+
import { FormComponentWrapper } from '../Common/FormComponentWrapper';
|
9
|
+
export class ViewOnlyComponent extends ReactComponent {
|
10
|
+
/**
|
11
|
+
* Called when the component has been instantiated. This is useful to define
|
12
|
+
* default instance variable values.
|
13
|
+
*
|
14
|
+
* @param component - The JSON representation of the component created.
|
15
|
+
* @param options - The global options for the renderer
|
16
|
+
* @param data - The contextual data object (model) used for this component.
|
17
|
+
*/
|
18
|
+
constructor(component, options, data) {
|
19
|
+
component.property = Object.assign({}, component.property);
|
20
|
+
super(Object.assign(Object.assign({}, component), { hideLabel: true }), options, data);
|
21
|
+
this.showValue = this.showValue.bind(this);
|
22
|
+
}
|
23
|
+
showValue(value) {
|
24
|
+
var _a, _b;
|
25
|
+
if (value == null || value == undefined)
|
26
|
+
return React.createElement("span", null, "\u00A0");
|
27
|
+
switch (this.component.type) {
|
28
|
+
case 'ViewOnlyObject':
|
29
|
+
if (this.component.defaultPages && this.component.property.objectId) {
|
30
|
+
const defaultPagePath = this.component.defaultPages[this.component.property.objectId];
|
31
|
+
return (React.createElement(Link, { sx: { cursor: 'pointer' }, href: defaultPagePath
|
32
|
+
? `${process.env.REACT_APP_API_ROOT ? '' : '/app'}${defaultPagePath.replace(':instanceId', value.id)}`
|
33
|
+
: undefined }, value.name));
|
34
|
+
}
|
35
|
+
return value.name;
|
36
|
+
case 'ViewOnlyMultiSelect':
|
37
|
+
if (isEmpty(this.component.data)) {
|
38
|
+
return value.join(', ');
|
39
|
+
}
|
40
|
+
else {
|
41
|
+
return value
|
42
|
+
.map((v) => {
|
43
|
+
var _a, _b, _c;
|
44
|
+
return (_c = (_b = (_a = this.component.data) === null || _a === void 0 ? void 0 : _a.values.find((val) => val.value === v)) === null || _b === void 0 ? void 0 : _b.label) !== null && _c !== void 0 ? _c : v;
|
45
|
+
})
|
46
|
+
.join(', ');
|
47
|
+
}
|
48
|
+
case 'ViewOnlySelect':
|
49
|
+
if (isEmpty(this.component.data)) {
|
50
|
+
return this.component.property.type === 'array' ? value.join(', ') : value;
|
51
|
+
}
|
52
|
+
else {
|
53
|
+
return ((_b = (_a = this.component.data.values.find((val) => val.value === value)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : value);
|
54
|
+
}
|
55
|
+
case 'ViewOnlyUser':
|
56
|
+
return value.name;
|
57
|
+
case 'ViewOnlyDate':
|
58
|
+
return DateTime.fromISO(value).toFormat('MM/dd/yyyy');
|
59
|
+
case 'ViewOnlyDateTime':
|
60
|
+
return DateTime.fromISO(value).toFormat('MM/dd/yyyy hh:mm a');
|
61
|
+
case 'ViewOnlyTime':
|
62
|
+
return DateTime.fromISO(DateTime.now().toISODate() + 'T' + value).toFormat('hh:mm a');
|
63
|
+
case 'ViewOnlyBoolean':
|
64
|
+
return value ? 'Yes' : 'No';
|
65
|
+
default:
|
66
|
+
return value;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
attachReact(element) {
|
70
|
+
let root = ReactDOM.findDOMNode(element);
|
71
|
+
if (!root) {
|
72
|
+
root = element;
|
73
|
+
}
|
74
|
+
if (!this.componentRoot) {
|
75
|
+
this.componentRoot = createRoot(root);
|
76
|
+
}
|
77
|
+
return this.componentRoot.render(React.createElement("div", null,
|
78
|
+
React.createElement(FormComponentWrapper, Object.assign({}, this.component, { viewOnly: true }),
|
79
|
+
React.createElement(Typography, { variant: "body1", key: this.component.key }, this.showValue(this.component.instance
|
80
|
+
? get(this.component.instance, this.component.key)
|
81
|
+
: this.component.defaultValue)))));
|
82
|
+
}
|
83
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export * from './ButtonComponent';
|
2
|
+
export * from './DocumentComponent/DocumentComponent';
|
3
|
+
export * from './FormFieldComponent';
|
4
|
+
export * from './ImageComponent/ImageComponent';
|
5
|
+
export * from './ObjectComponent/ObjectComponent';
|
6
|
+
export * from './RepeatableFieldComponent/RepeatableFieldComponent';
|
7
|
+
export * from './UserComponent/UserComponent';
|
8
|
+
export * from './ViewOnlyComponent';
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export * from './ButtonComponent';
|
2
|
+
export * from './DocumentComponent/DocumentComponent';
|
3
|
+
export * from './FormFieldComponent';
|
4
|
+
export * from './ImageComponent/ImageComponent';
|
5
|
+
export * from './ObjectComponent/ObjectComponent';
|
6
|
+
export * from './RepeatableFieldComponent/RepeatableFieldComponent';
|
7
|
+
export * from './UserComponent/UserComponent';
|
8
|
+
export * from './ViewOnlyComponent';
|
@@ -0,0 +1,109 @@
|
|
1
|
+
import { ApiServices, ObjectInstance, Property, Reference, UserAccount } from '@evoke-platform/context';
|
2
|
+
import { AutocompleteOption } from '../../core';
|
3
|
+
export declare type BaseFormComponentProps = {
|
4
|
+
key: string;
|
5
|
+
id: string;
|
6
|
+
type: string;
|
7
|
+
label: string;
|
8
|
+
inputId: string;
|
9
|
+
readOnly?: boolean;
|
10
|
+
instance: ObjectInstance;
|
11
|
+
property: Property;
|
12
|
+
viewOnly: boolean;
|
13
|
+
canUpdateProperty: boolean;
|
14
|
+
hidden?: boolean;
|
15
|
+
defaultPages?: Record<string, string>;
|
16
|
+
data?: {
|
17
|
+
values: AutocompleteOption[];
|
18
|
+
};
|
19
|
+
defaultValue?: unknown;
|
20
|
+
hideLabel?: boolean;
|
21
|
+
objectId?: string;
|
22
|
+
validate: {
|
23
|
+
required?: boolean;
|
24
|
+
criteria?: Record<string, unknown>;
|
25
|
+
minDate?: string;
|
26
|
+
maxDate?: string;
|
27
|
+
minTime?: string;
|
28
|
+
maxTime?: string;
|
29
|
+
min?: string;
|
30
|
+
max?: string;
|
31
|
+
minDocuments?: number;
|
32
|
+
maxDocuments?: number;
|
33
|
+
operator?: 'all' | 'any';
|
34
|
+
regexes?: {
|
35
|
+
regex: string;
|
36
|
+
errorMessage: string;
|
37
|
+
}[];
|
38
|
+
customMessage?: string;
|
39
|
+
};
|
40
|
+
conditional: {
|
41
|
+
when: string;
|
42
|
+
show: boolean;
|
43
|
+
eq: string;
|
44
|
+
};
|
45
|
+
user?: UserAccount;
|
46
|
+
errorMessage?: string;
|
47
|
+
fieldHeight?: 'small' | 'medium';
|
48
|
+
navigateTo: (path?: string) => void;
|
49
|
+
autoSave?: (update: Record<string, unknown>) => void;
|
50
|
+
baseUrl: string;
|
51
|
+
apiServices: ApiServices;
|
52
|
+
};
|
53
|
+
export declare type ObjectPropertyInputProps = {
|
54
|
+
id: string;
|
55
|
+
instance: ObjectInstance;
|
56
|
+
property: Property;
|
57
|
+
user?: UserAccount;
|
58
|
+
apiServices: ApiServices;
|
59
|
+
handleChangeObjectProperty: (propertyId: string, instance?: Reference | null) => void;
|
60
|
+
mode: 'default' | 'existingOnly';
|
61
|
+
displayOption?: 'dropdown' | 'dialogBox';
|
62
|
+
nestedFieldsView?: boolean;
|
63
|
+
canUpdateProperty?: boolean;
|
64
|
+
error?: boolean;
|
65
|
+
defaultPages?: Record<string, string>;
|
66
|
+
navigateTo?: (path: string) => void;
|
67
|
+
setSnackbarError?: (snackbarError: {
|
68
|
+
showAlert: boolean;
|
69
|
+
message?: string;
|
70
|
+
isError?: boolean;
|
71
|
+
}) => void;
|
72
|
+
filter?: Record<string, unknown>;
|
73
|
+
defaultValueCriteria?: Record<string, unknown>;
|
74
|
+
sortBy?: string;
|
75
|
+
orderBy?: string;
|
76
|
+
isModal?: boolean;
|
77
|
+
label?: string;
|
78
|
+
};
|
79
|
+
export declare type Address = {
|
80
|
+
line1?: string;
|
81
|
+
line2?: string;
|
82
|
+
city?: string;
|
83
|
+
county?: string;
|
84
|
+
state?: string;
|
85
|
+
zipCode?: string;
|
86
|
+
};
|
87
|
+
export declare type User = {
|
88
|
+
id: string;
|
89
|
+
name: string;
|
90
|
+
status: string;
|
91
|
+
};
|
92
|
+
export declare type AccessCheck = {
|
93
|
+
result: boolean;
|
94
|
+
};
|
95
|
+
export declare type Document = {
|
96
|
+
id: string;
|
97
|
+
name: string;
|
98
|
+
contentType: string;
|
99
|
+
size: number;
|
100
|
+
uploadedDate: string;
|
101
|
+
metadata: {
|
102
|
+
[field: string]: unknown;
|
103
|
+
};
|
104
|
+
versionId?: string;
|
105
|
+
};
|
106
|
+
export declare type SavedDocumentReference = {
|
107
|
+
id: string;
|
108
|
+
name: string;
|
109
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { ActionInput, ActionInputType, ApiServices, FormEntry, InputParameter, InputParameterReference, Obj, ObjectInstance, Property, PropertyType } from '@evoke-platform/context';
|
2
|
+
import { LocalDateTime } from '@js-joda/core';
|
3
|
+
import { AutocompleteOption } from '../../core';
|
4
|
+
import { ObjectPropertyInputProps } from './types';
|
5
|
+
export declare function determineComponentType(properties: Property[], parameter?: InputParameter): ActionInputType | undefined;
|
6
|
+
export declare function determineParameterType(componentType: string): PropertyType;
|
7
|
+
export declare function getFlattenEntries(entries: FormEntry[]): InputParameterReference[];
|
8
|
+
export declare function convertFormToComponents(entries: FormEntry[], parameters: InputParameter[], object: Obj): ActionInput[];
|
9
|
+
export declare function convertComponentsToForm(components: ActionInput[]): FormEntry[];
|
10
|
+
export declare function getMiddleObjectFilter(property: Property, instance: ObjectInstance): {
|
11
|
+
where: {
|
12
|
+
[x: string]: string;
|
13
|
+
};
|
14
|
+
};
|
15
|
+
export declare function getMiddleObject(instance: ObjectInstance, property: Property, endObjectId: string, endObjectName: string): {
|
16
|
+
[x: string]: {
|
17
|
+
id: string;
|
18
|
+
name: string;
|
19
|
+
};
|
20
|
+
} | undefined;
|
21
|
+
export declare function getMiddleInstance(instanceId: string, property: Property, middleObjectInstances: ObjectInstance[]): ObjectInstance | undefined;
|
22
|
+
export declare function getPrefixedUrl(url: string): string;
|
23
|
+
export declare function addObjectPropertiesToComponentProps(properties: Property[], formComponents: any[], instance?: ObjectInstance, objectPropertyInputProps?: ObjectPropertyInputProps, autoSave?: (data: Record<string, unknown>) => void, readOnly?: boolean, defaultPages?: Record<string, string>, navigateTo?: (path: string) => void, queryAddresses?: unknown, apiServices?: ApiServices, isModal?: boolean, fieldHeight?: 'small' | 'medium'): Promise<ActionInput[]>;
|
24
|
+
export declare function getDefaultValue(initialValue: unknown, selectOptions?: AutocompleteOption[]): unknown;
|
25
|
+
export declare const buildComponentPropsFromObjectProperties: (properties: Property[], objectId: string, instance?: ObjectInstance, objectPropertyInputProps?: ObjectPropertyInputProps, hasActionPermissions?: boolean, autoSave?: ((data: Record<string, unknown>) => void) | undefined, readOnly?: boolean, queryAddresses?: unknown, isModal?: boolean, fieldHeight?: 'small' | 'medium') => unknown[];
|
26
|
+
export declare const buildComponentPropsFromDocumentProperties: (documentProperties: [string, unknown][], readOnly?: boolean, autoSave?: ((data: Record<string, unknown>) => void) | undefined, fieldHeight?: 'small' | 'medium') => {
|
27
|
+
type: string;
|
28
|
+
key: string;
|
29
|
+
label: string;
|
30
|
+
readOnly: boolean | undefined;
|
31
|
+
defaultValue: unknown;
|
32
|
+
autoSave: ((data: Record<string, unknown>) => void) | undefined;
|
33
|
+
fieldHeight: "medium" | "small" | undefined;
|
34
|
+
}[];
|
35
|
+
export declare const OPERATOR_MAP: Record<string, string>;
|
36
|
+
export declare function transformToWhere(mongoQuery: object): Record<string, unknown>;
|
37
|
+
export declare function updateCriteriaInputs(criteria: Record<string, unknown>, field: string, fieldValue: string, isInputField?: boolean): void;
|
38
|
+
export declare function getAllCriteriaInputs(criteria: Record<string, unknown>): string[];
|
39
|
+
export declare function isPropertyVisible(conditional: {
|
40
|
+
when: string;
|
41
|
+
show: boolean;
|
42
|
+
eq: string;
|
43
|
+
}, formData: Record<string, unknown>): boolean;
|
44
|
+
export declare function normalizeDateTime(dateTime: LocalDateTime): string;
|
45
|
+
export declare function normalizeDates(instances: ObjectInstance[], object?: Obj): void;
|