@evoke-platform/ui-components 1.5.1-testing.1 → 1.6.0-dev.10
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/SwipeableDrawer/SwipeableDrawer.d.ts +4 -0
- package/dist/published/components/core/SwipeableDrawer/SwipeableDrawer.js +8 -0
- package/dist/published/components/core/SwipeableDrawer/index.d.ts +3 -0
- package/dist/published/components/core/SwipeableDrawer/index.js +3 -0
- package/dist/published/components/core/index.d.ts +2 -1
- package/dist/published/components/core/index.js +2 -1
- package/dist/published/components/custom/BuilderGrid/BuilderGrid.js +27 -27
- package/dist/published/components/custom/Form/Common/FormComponentWrapper.js +2 -13
- package/dist/published/components/custom/Form/FormComponents/FormFieldComponent.d.ts +1 -0
- package/dist/published/components/custom/Form/FormComponents/FormFieldComponent.js +1 -1
- package/dist/published/components/custom/Form/FormComponents/RepeatableFieldComponent/RepeatableField.js +87 -57
- package/dist/published/components/custom/Form/tests/Form.test.js +1 -1
- package/dist/published/components/custom/Form/utils.js +1 -0
- package/dist/published/components/custom/FormField/AddressFieldComponent/addressFieldComponent.js +1 -1
- package/dist/published/components/custom/FormField/BooleanSelect/BooleanSelect.js +3 -3
- package/dist/published/components/custom/FormField/DatePickerSelect/DatePickerSelect.js +7 -1
- package/dist/published/components/custom/FormField/DateTimePickerSelect/DateTimePickerSelect.js +7 -1
- package/dist/published/components/custom/FormField/FormField.d.ts +1 -0
- package/dist/published/components/custom/FormField/FormField.js +2 -1
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js +6 -3
- package/dist/published/components/custom/FormField/Select/Select.js +132 -20
- package/dist/published/components/custom/FormField/Select/Select.test.js +72 -3
- package/dist/published/components/custom/FormField/TimePickerSelect/TimePickerSelect.js +13 -3
- package/dist/published/components/custom/HistoryLog/HistoryData.d.ts +1 -0
- package/dist/published/components/custom/HistoryLog/HistoryData.js +14 -6
- package/dist/published/components/custom/HistoryLog/HistoryLoading.d.ts +4 -1
- package/dist/published/components/custom/HistoryLog/HistoryLoading.js +14 -8
- package/dist/published/components/custom/HistoryLog/index.d.ts +2 -0
- package/dist/published/components/custom/HistoryLog/index.js +4 -4
- package/dist/published/components/custom/ResponsiveOverflow/ResponsiveOverflow.d.ts +33 -0
- package/dist/published/components/custom/ResponsiveOverflow/ResponsiveOverflow.js +143 -0
- package/dist/published/components/custom/ResponsiveOverflow/ResponsiveOverflow.test.d.ts +1 -0
- package/dist/published/components/custom/ResponsiveOverflow/ResponsiveOverflow.test.js +100 -0
- package/dist/published/components/custom/ResponsiveOverflow/index.d.ts +4 -0
- package/dist/published/components/custom/ResponsiveOverflow/index.js +3 -0
- package/dist/published/components/custom/index.d.ts +1 -0
- package/dist/published/components/custom/index.js +1 -0
- package/dist/published/index.d.ts +2 -2
- package/dist/published/index.js +2 -2
- package/dist/published/stories/ResponsiveOverflow.stories.d.ts +8 -0
- package/dist/published/stories/ResponsiveOverflow.stories.js +91 -0
- package/dist/published/theme/hooks.d.ts +78 -0
- package/dist/published/theme/hooks.js +65 -0
- package/dist/published/theme/hooks.test.d.ts +1 -0
- package/dist/published/theme/hooks.test.js +187 -0
- package/dist/published/theme/index.d.ts +2 -2
- package/dist/published/theme/index.js +2 -2
- package/package.json +2 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SwipeableDrawer as MuiSwipeableDrawer } from '@mui/material';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import UIThemeProvider from '../../../theme';
|
|
4
|
+
const SwipeableDrawer = (props) => {
|
|
5
|
+
return (React.createElement(UIThemeProvider, null,
|
|
6
|
+
React.createElement(MuiSwipeableDrawer, { ...props })));
|
|
7
|
+
};
|
|
8
|
+
export default SwipeableDrawer;
|
|
@@ -37,6 +37,7 @@ export { Skeleton } from './Skeleton';
|
|
|
37
37
|
export { Snackbar } from './Snackbar';
|
|
38
38
|
export * from './StaticDatePicker';
|
|
39
39
|
export { Step, StepButton, StepConnector, StepContent, StepIcon, StepLabel, Stepper } from './Stepper';
|
|
40
|
+
export { SwipeableDrawer } from './SwipeableDrawer';
|
|
40
41
|
export { Switch } from './Switch';
|
|
41
42
|
export { Table } from './Table';
|
|
42
43
|
export { Tab, Tabs } from './Tabs';
|
|
@@ -47,7 +48,7 @@ export { Tooltip } from './Tooltip';
|
|
|
47
48
|
export { Typography } from './Typography';
|
|
48
49
|
export { TabContext, TabList, TabPanel, TreeItem, TreeView } from '@mui/lab';
|
|
49
50
|
export { CardActionArea, CardActions, CardContent, CardHeader, CardMedia, Input, InputAdornment, InputLabel, ListItemButton, ListItemText, MenuList, SvgIcon, TableBody, TableCell, TableContainer, TableHead, TablePagination, TableRow, TableSortLabel, } from '@mui/material';
|
|
50
|
-
export { useGridApiRef } from '@mui/x-data-grid';
|
|
51
|
+
export { GridToolbarContainer, GridToolbarQuickFilter, useGridApiRef } from '@mui/x-data-grid';
|
|
51
52
|
export { TreeItem as RichTreeItem, RichTreeView, TreeItem2Content, TreeItem2DragAndDropOverlay, TreeItem2GroupTransition, TreeItem2Icon, TreeItem2IconContainer, TreeItem2Label, TreeItem2Provider, TreeItem2Root, useTreeItem2, } from '@mui/x-tree-view';
|
|
52
53
|
export type { GridSize } from '@mui/material';
|
|
53
54
|
export type { GridCellParams, GridColDef, GridEventListener, GridFilterModel, GridInitialState, GridRowParams, GridSortModel, GridValueFormatterParams, GridValueGetterParams, } from '@mui/x-data-grid';
|
|
@@ -37,6 +37,7 @@ export { Skeleton } from './Skeleton';
|
|
|
37
37
|
export { Snackbar } from './Snackbar';
|
|
38
38
|
export * from './StaticDatePicker';
|
|
39
39
|
export { Step, StepButton, StepConnector, StepContent, StepIcon, StepLabel, Stepper } from './Stepper';
|
|
40
|
+
export { SwipeableDrawer } from './SwipeableDrawer';
|
|
40
41
|
export { Switch } from './Switch';
|
|
41
42
|
export { Table } from './Table';
|
|
42
43
|
export { Tab, Tabs } from './Tabs';
|
|
@@ -48,5 +49,5 @@ export { Typography } from './Typography';
|
|
|
48
49
|
//TODO: Review following components. They also need theme control:
|
|
49
50
|
export { TabContext, TabList, TabPanel, TreeItem, TreeView } from '@mui/lab';
|
|
50
51
|
export { CardActionArea, CardActions, CardContent, CardHeader, CardMedia, Input, InputAdornment, InputLabel, ListItemButton, ListItemText, MenuList, SvgIcon, TableBody, TableCell, TableContainer, TableHead, TablePagination, TableRow, TableSortLabel, } from '@mui/material';
|
|
51
|
-
export { useGridApiRef } from '@mui/x-data-grid';
|
|
52
|
+
export { GridToolbarContainer, GridToolbarQuickFilter, useGridApiRef } from '@mui/x-data-grid';
|
|
52
53
|
export { TreeItem as RichTreeItem, RichTreeView, TreeItem2Content, TreeItem2DragAndDropOverlay, TreeItem2GroupTransition, TreeItem2Icon, TreeItem2IconContainer, TreeItem2Label, TreeItem2Provider, TreeItem2Root, useTreeItem2, } from '@mui/x-tree-view';
|
|
@@ -17,7 +17,32 @@ const BuilderGrid = (props) => {
|
|
|
17
17
|
borderBottom: 'none',
|
|
18
18
|
boxShadow: 'rgba(145, 158, 171, 0.2) 0px 8px 16px',
|
|
19
19
|
} },
|
|
20
|
-
React.createElement(MuiDataGrid, { autoPageSize: !disablePagination, hideFooterPagination: disablePagination, hideFooter: disablePagination, onMenuOpen: (env) => setAnchorEl(env.target), loading: loading, rows: rows,
|
|
20
|
+
React.createElement(MuiDataGrid, { autoPageSize: !disablePagination, hideFooterPagination: disablePagination, hideFooter: disablePagination, onMenuOpen: (env) => setAnchorEl(env.target), loading: loading, rows: rows, getRowId: (row) => row.id, disableColumnMenu: true, initialState: {
|
|
21
|
+
sorting: {
|
|
22
|
+
sortModel: initialSort ? [initialSort] : [],
|
|
23
|
+
},
|
|
24
|
+
}, componentsProps: {
|
|
25
|
+
panel: {
|
|
26
|
+
anchorEl: anchorEl,
|
|
27
|
+
placement: 'bottom-end',
|
|
28
|
+
sx: {
|
|
29
|
+
'& .MuiPaper-root': {
|
|
30
|
+
borderRadius: '6px',
|
|
31
|
+
boxShadow: '0px 24px 48px rgba(145, 158, 171, 0.4)',
|
|
32
|
+
padding: '8px',
|
|
33
|
+
stop: -120,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
}, slots: {
|
|
38
|
+
toolbar: hideToolbar ? null : toolbar,
|
|
39
|
+
noResultsOverlay: () => {
|
|
40
|
+
return React.createElement(Box, null);
|
|
41
|
+
},
|
|
42
|
+
noRowsOverlay: () => {
|
|
43
|
+
return noRowsOverlay ? noRowsOverlay : null;
|
|
44
|
+
},
|
|
45
|
+
}, rowHeight: 60, columnHeaderHeight: 62, ...rest, sx: {
|
|
21
46
|
border: 'none',
|
|
22
47
|
'& .MuiDataGrid-toolbarContainer': {
|
|
23
48
|
padding: '0',
|
|
@@ -64,32 +89,7 @@ const BuilderGrid = (props) => {
|
|
|
64
89
|
},
|
|
65
90
|
height: disablePagination && !loading ? 'auto' : 'calc(100vh - 240px)',
|
|
66
91
|
...rest.sx,
|
|
67
|
-
}
|
|
68
|
-
sorting: {
|
|
69
|
-
sortModel: initialSort ? [initialSort] : [],
|
|
70
|
-
},
|
|
71
|
-
}, componentsProps: {
|
|
72
|
-
panel: {
|
|
73
|
-
anchorEl: anchorEl,
|
|
74
|
-
placement: 'bottom-end',
|
|
75
|
-
sx: {
|
|
76
|
-
'& .MuiPaper-root': {
|
|
77
|
-
borderRadius: '6px',
|
|
78
|
-
boxShadow: '0px 24px 48px rgba(145, 158, 171, 0.4)',
|
|
79
|
-
padding: '8px',
|
|
80
|
-
stop: -120,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
}, slots: {
|
|
85
|
-
toolbar: hideToolbar ? null : toolbar,
|
|
86
|
-
noResultsOverlay: () => {
|
|
87
|
-
return React.createElement(Box, null);
|
|
88
|
-
},
|
|
89
|
-
noRowsOverlay: () => {
|
|
90
|
-
return noRowsOverlay ? noRowsOverlay : null;
|
|
91
|
-
},
|
|
92
|
-
}, rowHeight: 60, columnHeaderHeight: 62 }))) : (React.createElement(React.Fragment, null, error ? (React.createElement(Box, { sx: {
|
|
92
|
+
} }))) : (React.createElement(React.Fragment, null, error ? (React.createElement(Box, { sx: {
|
|
93
93
|
backgroundColor: '#fff',
|
|
94
94
|
borderRadius: '6px',
|
|
95
95
|
display: 'flex',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { ErrorRounded, Help
|
|
2
|
+
import { ErrorRounded, Help } from '../../../../icons';
|
|
3
3
|
import { IconButton, Tooltip, Typography } from '../../../core';
|
|
4
4
|
import { Box } from '../../../layout';
|
|
5
5
|
const underFieldStyles = {
|
|
@@ -13,11 +13,6 @@ const descriptionStyles = {
|
|
|
13
13
|
whiteSpace: 'normal',
|
|
14
14
|
paddingBottom: '4px',
|
|
15
15
|
};
|
|
16
|
-
const clearBtnStyles = {
|
|
17
|
-
color: '#637381',
|
|
18
|
-
fontSize: '1.2rem',
|
|
19
|
-
marginBottom: '2px',
|
|
20
|
-
};
|
|
21
16
|
const PrefixSuffix = (props) => {
|
|
22
17
|
const { prefix, suffix, height } = props;
|
|
23
18
|
const text = prefix || suffix;
|
|
@@ -51,7 +46,7 @@ const PrefixSuffix = (props) => {
|
|
|
51
46
|
* description, tooltip, prefix, suffix and word/char counts
|
|
52
47
|
*/
|
|
53
48
|
export const FormComponentWrapper = (props) => {
|
|
54
|
-
const { inputId, label, description, tooltip, prefix, suffix, value, validate, errorMessage, showCharCount, type, viewOnly, children, displayOption,
|
|
49
|
+
const { inputId, label, description, tooltip, prefix, suffix, value, validate, errorMessage, showCharCount, type, viewOnly, children, displayOption, property, } = props;
|
|
55
50
|
const [fieldHeight, setFieldHeight] = useState(40);
|
|
56
51
|
const { maxLength } = validate;
|
|
57
52
|
const fieldRef = useRef(null);
|
|
@@ -76,12 +71,6 @@ export const FormComponentWrapper = (props) => {
|
|
|
76
71
|
tooltip && (React.createElement(Tooltip, { placement: "right", title: tooltip },
|
|
77
72
|
React.createElement(IconButton, null,
|
|
78
73
|
React.createElement(Help, { sx: { fontSize: '14px' } }))))),
|
|
79
|
-
displayOption === 'radioButton' && onChange && !viewOnly && !readOnly && value && (React.createElement(Tooltip, { title: `Clear` },
|
|
80
|
-
React.createElement("span", null,
|
|
81
|
-
React.createElement(IconButton, { "aria-label": `Clear`, sx: { padding: '0px' }, onClick: () => {
|
|
82
|
-
property && onChange(property.id, '');
|
|
83
|
-
} },
|
|
84
|
-
React.createElement(HighlightOffOutlined, { sx: clearBtnStyles }))))),
|
|
85
74
|
React.createElement(Box, { sx: { ...(displayOption === 'radioButton' && { display: 'flex' }) } },
|
|
86
75
|
React.createElement(Typography, { variant: "caption", sx: descriptionStyles }, description)))),
|
|
87
76
|
React.createElement(Box, { sx: { display: 'flex', flexDirection: 'row' } },
|
|
@@ -12,6 +12,7 @@ type FormFieldComponentProps = Omit<BaseFormComponentProps, 'property'> & {
|
|
|
12
12
|
initialValue?: string;
|
|
13
13
|
displayOption?: 'radioButton' | 'dropdown';
|
|
14
14
|
strictlyTrue?: boolean;
|
|
15
|
+
nonStrictEnum?: boolean;
|
|
15
16
|
};
|
|
16
17
|
export declare class FormFieldComponent extends ReactComponent {
|
|
17
18
|
[x: string]: any;
|
|
@@ -485,6 +485,6 @@ export class FormFieldComponent extends ReactComponent {
|
|
|
485
485
|
falsePositiveMaskError &&
|
|
486
486
|
isEmpty(this.errorDetails) &&
|
|
487
487
|
this.emit('changed-' + this.component.key, e.target.value);
|
|
488
|
-
}, ...this.component, id: inputId, defaultValue: this.dataValue, mask: this.component.inputMask, error: this.hasErrors(), size: this.component.fieldHeight ?? 'medium', required: this.component.property.type === 'boolean' ? this.component.strictlyTrue : undefined }))), root);
|
|
488
|
+
}, ...this.component, id: inputId, defaultValue: this.dataValue, mask: this.component.inputMask, error: this.hasErrors(), size: this.component.fieldHeight ?? 'medium', required: this.component.property.type === 'boolean' ? this.component.strictlyTrue : undefined, isCombobox: this.component.nonStrictEnum }))), root);
|
|
489
489
|
}
|
|
490
490
|
}
|
|
@@ -7,6 +7,7 @@ import sift from 'sift';
|
|
|
7
7
|
import { Edit, TrashCan } from '../../../../../icons';
|
|
8
8
|
import { Button, IconButton, Skeleton, Snackbar, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Tooltip, Typography, } from '../../../../core';
|
|
9
9
|
import { Box } from '../../../../layout';
|
|
10
|
+
import { getReadableQuery } from '../../../CriteriaBuilder';
|
|
10
11
|
import { getPrefixedUrl, normalizeDateTime, retrieveCustomErrorMessage } from '../../utils';
|
|
11
12
|
import { ActionDialog } from './ActionDialog';
|
|
12
13
|
import { DocumentViewerCell } from './DocumentViewerCell';
|
|
@@ -37,6 +38,7 @@ const RepeatableField = (props) => {
|
|
|
37
38
|
const [relatedObject, setRelatedObject] = useState();
|
|
38
39
|
const [hasCreateAction, setHasCreateAction] = useState(false);
|
|
39
40
|
const [users, setUsers] = useState();
|
|
41
|
+
const [criteriaObjects, setCriteriaObjects] = useState([]);
|
|
40
42
|
const [openDialog, setOpenDialog] = useState(false);
|
|
41
43
|
const [dialogType, setDialogType] = useState();
|
|
42
44
|
const [selectedRow, setSelectedRow] = useState();
|
|
@@ -50,9 +52,7 @@ const RepeatableField = (props) => {
|
|
|
50
52
|
const [error, setError] = useState(false);
|
|
51
53
|
const DEFAULT_CREATE_ACTION = '_create';
|
|
52
54
|
const { instanceChanges } = useNotification();
|
|
53
|
-
const
|
|
54
|
-
if (openDialog)
|
|
55
|
-
return;
|
|
55
|
+
const fetchRelatedObject = useCallback(async () => {
|
|
56
56
|
let relatedObject;
|
|
57
57
|
if (property.objectId) {
|
|
58
58
|
try {
|
|
@@ -80,31 +80,86 @@ const RepeatableField = (props) => {
|
|
|
80
80
|
catch (err) {
|
|
81
81
|
console.error(error);
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
clearTimeout(timeout);
|
|
83
|
+
}
|
|
84
|
+
relatedObject && checkCreateAccess(relatedObject);
|
|
85
|
+
}, [apiServices, property]);
|
|
86
|
+
const fetchRelatedInstances = useCallback(async () => {
|
|
87
|
+
if (openDialog)
|
|
88
|
+
return;
|
|
89
|
+
if (property.objectId && property.relatedPropertyId && instance?.id) {
|
|
90
|
+
const filterProperty = `${property.relatedPropertyId}.id`;
|
|
91
|
+
const filter = { where: { [filterProperty]: instance?.id }, limit: 100 };
|
|
92
|
+
const objectId = property.objectId;
|
|
93
|
+
try {
|
|
94
|
+
const timeout = setTimeout(() => {
|
|
96
95
|
setLoading(false);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
}, 300);
|
|
97
|
+
setLoading(true);
|
|
98
|
+
const instances = await apiServices.get(getPrefixedUrl(`/objects/${objectId}/instances`), {
|
|
99
|
+
params: { filter: JSON.stringify(filter) },
|
|
100
|
+
});
|
|
101
|
+
clearTimeout(timeout);
|
|
102
|
+
setLoading(false);
|
|
103
|
+
if (instances) {
|
|
104
|
+
setRelatedInstances(instances);
|
|
103
105
|
}
|
|
104
106
|
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
setError(true);
|
|
109
|
+
}
|
|
105
110
|
}
|
|
106
|
-
|
|
107
|
-
|
|
111
|
+
}, [apiServices, property]);
|
|
112
|
+
const fetchCriteriaObjects = useCallback(async () => {
|
|
113
|
+
let objectIds = [];
|
|
114
|
+
const criteriaProperties = relatedObject?.properties?.filter((property) => property.type === 'criteria' && property.objectId) ?? [];
|
|
115
|
+
if (tableViewLayout) {
|
|
116
|
+
objectIds = criteriaProperties
|
|
117
|
+
.filter((p) => tableViewLayout.properties.some((column) => column.id === p.id))
|
|
118
|
+
.map((property) => property.objectId);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
objectIds = criteriaProperties.map((p) => p.objectId);
|
|
122
|
+
}
|
|
123
|
+
const objects = [];
|
|
124
|
+
for (const objectId of new Set(objectIds)) {
|
|
125
|
+
try {
|
|
126
|
+
const criteriaObject = await apiServices.get(getPrefixedUrl(`/objects/${objectId}/effective`), {
|
|
127
|
+
params: { fields: ['id', 'name', 'properties'] },
|
|
128
|
+
});
|
|
129
|
+
objects.push(criteriaObject);
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
console.error(`Error fetching criteria object with ID ${objectId}:`, error);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
setCriteriaObjects(objects);
|
|
136
|
+
}, [apiServices, relatedObject, tableViewLayout]);
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
(async () => {
|
|
139
|
+
try {
|
|
140
|
+
const users = await apiServices.get(getPrefixedUrl(`/users`));
|
|
141
|
+
setUsers(users);
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
console.error(error);
|
|
145
|
+
}
|
|
146
|
+
})();
|
|
147
|
+
}, [apiServices]);
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
fetchRelatedObject();
|
|
150
|
+
fetchRelatedInstances();
|
|
151
|
+
}, [fetchRelatedInstances, fetchRelatedObject, reloadOnErrorTrigger, instance]);
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
if (relatedObject)
|
|
154
|
+
fetchCriteriaObjects();
|
|
155
|
+
}, [fetchCriteriaObjects, relatedObject]);
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
if (relatedObject?.rootObjectId) {
|
|
158
|
+
const callback = () => fetchRelatedInstances();
|
|
159
|
+
instanceChanges?.subscribe(relatedObject?.rootObjectId, callback);
|
|
160
|
+
return () => instanceChanges?.unsubscribe(relatedObject?.rootObjectId, callback);
|
|
161
|
+
}
|
|
162
|
+
}, [instanceChanges, relatedObject]);
|
|
108
163
|
const retrieveCriteria = (relatedObjProperty, action, object) => {
|
|
109
164
|
let property;
|
|
110
165
|
if (action.parameters) {
|
|
@@ -171,27 +226,6 @@ const RepeatableField = (props) => {
|
|
|
171
226
|
});
|
|
172
227
|
}
|
|
173
228
|
};
|
|
174
|
-
useEffect(() => {
|
|
175
|
-
(async () => {
|
|
176
|
-
try {
|
|
177
|
-
const users = await apiServices.get(getPrefixedUrl(`/users`));
|
|
178
|
-
setUsers(users);
|
|
179
|
-
}
|
|
180
|
-
catch (error) {
|
|
181
|
-
console.error(error);
|
|
182
|
-
}
|
|
183
|
-
})();
|
|
184
|
-
}, [apiServices]);
|
|
185
|
-
useEffect(() => {
|
|
186
|
-
fetchRelatedInstances();
|
|
187
|
-
}, [fetchRelatedInstances, reloadOnErrorTrigger, instance]);
|
|
188
|
-
useEffect(() => {
|
|
189
|
-
if (relatedObject?.rootObjectId) {
|
|
190
|
-
const callback = () => fetchRelatedInstances();
|
|
191
|
-
instanceChanges?.subscribe(relatedObject?.rootObjectId, callback);
|
|
192
|
-
return () => instanceChanges?.unsubscribe(relatedObject?.rootObjectId, callback);
|
|
193
|
-
}
|
|
194
|
-
}, [instanceChanges, relatedObject]);
|
|
195
229
|
const deleteRow = (id) => {
|
|
196
230
|
setDialogType('delete');
|
|
197
231
|
setSelectedRow(id);
|
|
@@ -334,28 +368,24 @@ const RepeatableField = (props) => {
|
|
|
334
368
|
};
|
|
335
369
|
const getValue = (relatedInstance, propertyId, propertyType) => {
|
|
336
370
|
const value = get(relatedInstance, propertyId);
|
|
337
|
-
// If the property is not date-like then just return the
|
|
338
|
-
// value found at the given path.
|
|
339
|
-
if (!['date', 'date-time', 'time'].includes(propertyType)) {
|
|
340
|
-
return value;
|
|
341
|
-
}
|
|
342
371
|
// If the date-like value is empty then there is no need to format.
|
|
343
372
|
if (!value) {
|
|
344
373
|
return value;
|
|
345
374
|
}
|
|
346
|
-
// At this point it has been asserted that there is a value
|
|
347
|
-
// and since the property is date-like the value must be
|
|
348
|
-
// a string.
|
|
349
|
-
const stringValue = value;
|
|
350
375
|
if (propertyType === 'date') {
|
|
351
|
-
return DateTime.fromISO(
|
|
376
|
+
return DateTime.fromISO(value).toLocaleString(DateTime.DATE_SHORT);
|
|
352
377
|
}
|
|
353
378
|
if (propertyType === 'date-time') {
|
|
354
|
-
return DateTime.fromISO(
|
|
379
|
+
return DateTime.fromISO(value).toLocaleString(DateTime.DATETIME_SHORT);
|
|
355
380
|
}
|
|
356
381
|
if (propertyType === 'time') {
|
|
357
|
-
return DateTime.fromISO(
|
|
382
|
+
return DateTime.fromISO(value).toLocaleString(DateTime.TIME_SIMPLE);
|
|
383
|
+
}
|
|
384
|
+
if (propertyType === 'criteria' && typeof value === 'object') {
|
|
385
|
+
const property = relatedObject?.properties?.find((p) => p.id === propertyId);
|
|
386
|
+
return getReadableQuery(value, criteriaObjects.find((o) => o.id === property?.objectId)?.properties ?? []);
|
|
358
387
|
}
|
|
388
|
+
return value;
|
|
359
389
|
};
|
|
360
390
|
const columns = retrieveViewLayout();
|
|
361
391
|
return loading ? (React.createElement(React.Fragment, null,
|
|
@@ -6,7 +6,7 @@ import { isEqual } from 'lodash';
|
|
|
6
6
|
import { http, HttpResponse } from 'msw';
|
|
7
7
|
import { setupServer } from 'msw/node';
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import { it } from 'vitest';
|
|
9
|
+
import { expect, it } from 'vitest';
|
|
10
10
|
import Form from '../Common/Form';
|
|
11
11
|
import { licenseObject, npLicense, npSpecialtyType1, npSpecialtyType2, rnLicense, rnSpecialtyType1, rnSpecialtyType2, specialtyObject, specialtyTypeObject, } from './test-data';
|
|
12
12
|
const removePoppers = () => {
|
|
@@ -165,6 +165,7 @@ export function convertFormToComponents(entries, parameters, object) {
|
|
|
165
165
|
data: {
|
|
166
166
|
values: entry.type === 'input' ? entry.enumWithLabels : undefined,
|
|
167
167
|
},
|
|
168
|
+
nonStrictEnum: parameter.nonStrictEnum,
|
|
168
169
|
property: property,
|
|
169
170
|
defaultToCurrentTime: displayOptions?.defaultValue === 'currentTime' && parameter.type === 'time' ? true : false,
|
|
170
171
|
defaultToCurrentDate: displayOptions?.defaultValue === 'currentDate' && parameter.type === 'date' ? true : false,
|
package/dist/published/components/custom/FormField/AddressFieldComponent/addressFieldComponent.js
CHANGED
|
@@ -45,7 +45,7 @@ const AddressFieldComponent = (props) => {
|
|
|
45
45
|
setAnchorEl(null);
|
|
46
46
|
};
|
|
47
47
|
return (React.createElement(Box, null,
|
|
48
|
-
!mask ? (React.createElement(TextField, { id: id, inputRef: textFieldRef, onChange: !readOnly ? handleChange : undefined, error: error, errorMessage: errorMessage, value: value, fullWidth: true, onBlur: onBlur, size: size ?? 'medium', placeholder: placeholder, InputProps: {
|
|
48
|
+
!mask ? (React.createElement(TextField, { id: id, inputRef: textFieldRef, onChange: !readOnly ? handleChange : undefined, error: error, errorMessage: errorMessage, value: value, fullWidth: true, onBlur: onBlur, size: size ?? 'medium', placeholder: readOnly ? undefined : placeholder, InputProps: {
|
|
49
49
|
type: 'search',
|
|
50
50
|
autoComplete: 'off',
|
|
51
51
|
}, required: required, readOnly: readOnly, multiline: property.type === 'string' && !readOnly && isMultiLineText, rows: isMultiLineText ? (rows ? rows : 3) : undefined, ...(additionalProps ?? {}) })) : (React.createElement(InputMask, { mask: mask, maskChar: inputMaskPlaceholderChar ?? '_', value: value, onChange: !readOnly ? handleChange : undefined, onBlur: onBlur, alwaysShowMask: true }, (() => (React.createElement(TextField, { id: id, inputRef: textFieldRef, sx: readOnly
|
|
@@ -56,12 +56,12 @@ const BooleanSelect = (props) => {
|
|
|
56
56
|
return readOnlyComponent();
|
|
57
57
|
}
|
|
58
58
|
return displayOption === 'dropdown' ? (React.createElement(Autocomplete, { renderInput: (params) => (React.createElement(TextField, { ...params, error: error, errorMessage: errorMessage, onBlur: onBlur, fullWidth: true, sx: { background: 'white' }, placeholder: placeholder, size: size ?? 'medium' })), value: booleanOptions.find((opt) => opt.value === value) ?? '', onChange: (e, selectedValue) => handleChange(selectedValue.value), isOptionEqualToValue: (option, val) => option?.value === val?.value, options: booleanOptions, disableClearable: true, sx: { background: 'white', borderRadius: '8px' }, ...(additionalProps ?? {}), sortBy: "NONE", required: strictlyTrue })) : (React.createElement(FormControl, { required: strictlyTrue, error: error, fullWidth: true },
|
|
59
|
-
React.createElement(FormControlLabel, { labelPlacement: "end", label: labelComponent(), control: displayOption === 'switch' ? (React.createElement(Switch, { id: id, "aria-required": strictlyTrue, "aria-invalid": error, size: size ?? 'medium', name: property.id, checked: value, onChange: (e) => handleChange(e.target.checked), sx: {
|
|
59
|
+
React.createElement(FormControlLabel, { labelPlacement: "end", label: labelComponent(), sx: { marginLeft: '-8px' }, control: displayOption === 'switch' ? (React.createElement(Switch, { id: id, "aria-required": strictlyTrue, "aria-invalid": error, size: size ?? 'medium', name: property.id, checked: value, onChange: (e) => handleChange(e.target.checked), sx: {
|
|
60
60
|
alignSelf: 'start',
|
|
61
|
-
} })) : (React.createElement(Checkbox, { id: id, "aria-required": strictlyTrue, "aria-invalid": error, size: size ?? 'medium', checked: value, name: property.id, onChange: (e) => handleChange(e.target.checked), sx: {
|
|
61
|
+
}, ...(additionalProps ?? {}) })) : (React.createElement(Checkbox, { id: id, "aria-required": strictlyTrue, "aria-invalid": error, size: size ?? 'medium', checked: value, name: property.id, onChange: (e) => handleChange(e.target.checked), sx: {
|
|
62
62
|
alignSelf: 'start',
|
|
63
63
|
padding: '4px 9px 9px 9px',
|
|
64
|
-
} })) }),
|
|
64
|
+
}, ...(additionalProps ?? {}) })) }),
|
|
65
65
|
error && errorMessage?.length && React.createElement(FormHelperText, { sx: { marginX: 0 } }, errorMessage),
|
|
66
66
|
descriptionComponent()));
|
|
67
67
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DateTimeFormatter } from '@js-joda/core';
|
|
2
|
+
import { omit } from 'lodash';
|
|
2
3
|
import React, { useEffect, useState } from 'react';
|
|
3
4
|
import { InvalidDate, LocalDate, nativeJs } from '../../../../util';
|
|
4
5
|
import { DatePicker, LocalizationProvider, TextField } from '../../../core';
|
|
@@ -36,6 +37,11 @@ const DatePickerSelect = (props) => {
|
|
|
36
37
|
onChange && onChange(property.id, date, property);
|
|
37
38
|
};
|
|
38
39
|
return readOnly ? (React.createElement(InputFieldComponent, { ...{ ...props, defaultValue: asMonthDayYearFormat(value) } })) : (React.createElement(LocalizationProvider, null,
|
|
39
|
-
React.createElement(DatePicker, { value: value, onChange: handleChange, inputFormat: "MM/dd/yyyy", renderInput: (params) => (React.createElement(TextField, { ...params, id: id, error: error, errorMessage: errorMessage, onBlur: onBlur, fullWidth: true, required: required, sx: { background: 'white', borderRadius: '8px' }, size: size ?? 'medium',
|
|
40
|
+
React.createElement(DatePicker, { value: value, onChange: handleChange, inputFormat: "MM/dd/yyyy", renderInput: (params) => (React.createElement(TextField, { ...params, id: id, error: error, errorMessage: errorMessage, onBlur: onBlur, fullWidth: true, required: required, sx: { background: 'white', borderRadius: '8px' }, size: size ?? 'medium',
|
|
41
|
+
// merges MUI inputProps with additionalProps.inputProps in a way that still shows the value
|
|
42
|
+
inputProps: {
|
|
43
|
+
...params.inputProps,
|
|
44
|
+
...(additionalProps?.inputProps ?? {}),
|
|
45
|
+
}, ...omit(additionalProps, ['inputProps']) })) })));
|
|
40
46
|
};
|
|
41
47
|
export default DatePickerSelect;
|
package/dist/published/components/custom/FormField/DateTimePickerSelect/DateTimePickerSelect.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LocalDate, LocalDateTime, LocalTime, nativeJs } from '@js-joda/core';
|
|
2
|
+
import { omit } from 'lodash';
|
|
2
3
|
import React, { useEffect, useState } from 'react';
|
|
3
4
|
import { InvalidDate } from '../../../../util';
|
|
4
5
|
import { DateTimePicker, LocalizationProvider, TextField } from '../../../core';
|
|
@@ -43,6 +44,11 @@ const DateTimePickerSelect = (props) => {
|
|
|
43
44
|
props.onChange && props.onChange(property.id, date, property);
|
|
44
45
|
};
|
|
45
46
|
return readOnly ? (React.createElement(InputFieldComponent, { ...{ ...props, defaultValue: formatDateTime(value) } })) : (React.createElement(LocalizationProvider, null,
|
|
46
|
-
React.createElement(DateTimePicker, { value: value, onChange: handleChange, renderInput: (params) => (React.createElement(TextField, { ...params, id: id, error: error, errorMessage: errorMessage, onBlur: onBlur, fullWidth: true, required: required, sx: { background: 'white', borderRadius: '8px' }, size: size ?? 'medium',
|
|
47
|
+
React.createElement(DateTimePicker, { value: value, onChange: handleChange, renderInput: (params) => (React.createElement(TextField, { ...params, id: id, error: error, errorMessage: errorMessage, onBlur: onBlur, fullWidth: true, required: required, sx: { background: 'white', borderRadius: '8px' }, size: size ?? 'medium',
|
|
48
|
+
// merges MUI inputProps with additionalProps.inputProps in a way that still shows the value
|
|
49
|
+
inputProps: {
|
|
50
|
+
...params.inputProps,
|
|
51
|
+
...(additionalProps?.inputProps ?? {}),
|
|
52
|
+
}, ...omit(additionalProps, ['inputProps']) })) })));
|
|
47
53
|
};
|
|
48
54
|
export default DateTimePickerSelect;
|
|
@@ -8,7 +8,7 @@ import InputFieldComponent from './InputFieldComponent/InputFieldComponent';
|
|
|
8
8
|
import Select from './Select/Select';
|
|
9
9
|
import TimePickerSelect from './TimePickerSelect/TimePickerSelect';
|
|
10
10
|
const FormField = (props) => {
|
|
11
|
-
const { id, defaultValue, error, onChange, property, readOnly, selectOptions, required, strictlyTrue, size, placeholder, errorMessage, onBlur, mask, max, min, isMultiLineText, rows, inputMaskPlaceholderChar, queryAddresses, isOptionEqualToValue, renderOption, disableCloseOnSelect, getOptionLabel, additionalProps, displayOption, sortBy, label, description, tooltip, } = props;
|
|
11
|
+
const { id, defaultValue, error, onChange, property, readOnly, selectOptions, required, strictlyTrue, size, placeholder, errorMessage, onBlur, mask, max, min, isMultiLineText, rows, inputMaskPlaceholderChar, queryAddresses, isOptionEqualToValue, renderOption, disableCloseOnSelect, getOptionLabel, additionalProps, displayOption, sortBy, label, description, tooltip, isCombobox, } = props;
|
|
12
12
|
let control;
|
|
13
13
|
const commonProps = {
|
|
14
14
|
id: id ?? property.id,
|
|
@@ -36,6 +36,7 @@ const FormField = (props) => {
|
|
|
36
36
|
label,
|
|
37
37
|
description,
|
|
38
38
|
tooltip,
|
|
39
|
+
isCombobox,
|
|
39
40
|
};
|
|
40
41
|
if (queryAddresses) {
|
|
41
42
|
control = (React.createElement(AddressFieldComponent, { ...commonProps, mask: mask, inputMaskPlaceholderChar: inputMaskPlaceholderChar, isMultiLineText: isMultiLineText, rows: rows, queryAddresses: queryAddresses }));
|
package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js
CHANGED
|
@@ -36,9 +36,12 @@ const InputFieldComponent = (props) => {
|
|
|
36
36
|
setInputValue(selectValue);
|
|
37
37
|
};
|
|
38
38
|
const InputProps = property.type === 'number'
|
|
39
|
-
? {
|
|
39
|
+
? {
|
|
40
|
+
inputComponent: NumericFormat,
|
|
41
|
+
inputProps: { min, max, readOnly, ...(additionalProps?.inputProps ?? {}) },
|
|
42
|
+
}
|
|
40
43
|
: property.type === 'integer'
|
|
41
|
-
? { inputProps: { min, max } }
|
|
44
|
+
? { inputProps: { min, max, ...(additionalProps?.inputProps ?? {}) } }
|
|
42
45
|
: null;
|
|
43
46
|
return property.enum && !readOnly ? (React.createElement(Autocomplete, { id: id,
|
|
44
47
|
// note: this is different between widgets and builder
|
|
@@ -62,7 +65,7 @@ const InputFieldComponent = (props) => {
|
|
|
62
65
|
backgroundColor: '#f4f6f8',
|
|
63
66
|
},
|
|
64
67
|
}),
|
|
65
|
-
}, error: error, errorMessage: errorMessage, value: value, onChange: !readOnly ? handleChange : undefined, InputProps: { ...InputProps, readOnly: readOnly }, required: required, fullWidth: true, onBlur: onBlur, placeholder: placeholder, size: size ?? 'medium', type: property.type === 'integer' ? 'number' : 'text', multiline: property.type === 'string' && !readOnly && isMultiLineText, rows: isMultiLineText ? (rows ? rows : 3) : undefined, ...(additionalProps ?? {}) })) : (React.createElement(InputMask, { mask: mask, maskChar: inputMaskPlaceholderChar ?? '_', value: value, onChange: !readOnly ? handleChange : undefined, onBlur: onBlur, alwaysShowMask: true }, (() => (React.createElement(TextField, { id: id, sx: readOnly
|
|
68
|
+
}, error: error, errorMessage: errorMessage, value: value, onChange: !readOnly ? handleChange : undefined, InputProps: { ...InputProps, readOnly: readOnly }, required: required, fullWidth: true, onBlur: onBlur, placeholder: readOnly ? undefined : placeholder, size: size ?? 'medium', type: property.type === 'integer' ? 'number' : 'text', multiline: property.type === 'string' && !readOnly && isMultiLineText, rows: isMultiLineText ? (rows ? rows : 3) : undefined, ...(additionalProps ?? {}) })) : (React.createElement(InputMask, { mask: mask, maskChar: inputMaskPlaceholderChar ?? '_', value: value, onChange: !readOnly ? handleChange : undefined, onBlur: onBlur, alwaysShowMask: true }, (() => (React.createElement(TextField, { id: id, sx: readOnly
|
|
66
69
|
? {
|
|
67
70
|
'& .MuiOutlinedInput-notchedOutline': {
|
|
68
71
|
border: 'none',
|