@evoke-platform/ui-components 1.0.0-dev.226 → 1.0.0-dev.227
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 +61 -60
- 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
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { Autocomplete, TextField } from '../../../core';
|
3
3
|
import InputFieldComponent from '../InputFieldComponent/InputFieldComponent';
|
4
4
|
const Select = (props) => {
|
5
|
-
var _a, _b;
|
6
5
|
const { id, property, defaultValue, error, errorMessage, onBlur, readOnly, selectOptions, required, size, isOptionEqualToValue, renderOption, getOptionLabel, disableCloseOnSelect, additionalProps, } = props;
|
7
6
|
const [value, setValue] = useState(defaultValue);
|
8
7
|
const [inputValue, setInputValue] = useState('');
|
@@ -12,8 +11,8 @@ const Select = (props) => {
|
|
12
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
13
12
|
const handleChange = (event, selected) => {
|
14
13
|
if (Array.isArray(selected)) {
|
15
|
-
setValue(selected.map((option) =>
|
16
|
-
props.onChange(property.id, selected.map((option) =>
|
14
|
+
setValue(selected.map((option) => option.value ?? option));
|
15
|
+
props.onChange(property.id, selected.map((option) => option.value ?? option), property);
|
17
16
|
}
|
18
17
|
else {
|
19
18
|
setValue(selected);
|
@@ -23,16 +22,16 @@ const Select = (props) => {
|
|
23
22
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
24
23
|
const handleInputValueChange = (event, selectValue) => {
|
25
24
|
if (Array.isArray(selectValue)) {
|
26
|
-
setValue(selectValue.map((item) =>
|
25
|
+
setValue(selectValue.map((item) => item.value ?? item));
|
27
26
|
}
|
28
27
|
else {
|
29
28
|
setInputValue(selectValue);
|
30
29
|
}
|
31
30
|
};
|
32
|
-
return readOnly ? (React.createElement(InputFieldComponent,
|
31
|
+
return readOnly ? (React.createElement(InputFieldComponent, { ...props })) : (React.createElement(Autocomplete, { multiple: property?.type === 'array' ? true : false, id: id, renderInput: (params) => (React.createElement(TextField, { ...params, value: value, fullWidth: true, onBlur: onBlur })), value: value ?? (property?.type === 'array' ? [] : undefined), onChange: handleChange, options: selectOptions ?? property?.enum ?? [], disableClearable: true, inputValue: inputValue ?? '', error: error, errorMessage: errorMessage, required: required, onInputChange: handleInputValueChange, size: size, isOptionEqualToValue: isOptionEqualToValue
|
33
32
|
? (option, value) => isOptionEqualToValue(option, value)
|
34
33
|
: undefined, getOptionLabel: getOptionLabel ? (option) => getOptionLabel(option) : undefined, renderOption: renderOption
|
35
34
|
? (props, option, state) => renderOption(props, option, state)
|
36
|
-
: undefined, disableCloseOnSelect: disableCloseOnSelect
|
35
|
+
: undefined, disableCloseOnSelect: disableCloseOnSelect, ...(additionalProps ?? {}) }));
|
37
36
|
};
|
38
37
|
export default Select;
|
@@ -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 '@testing-library/jest-dom/extend-expect';
|
11
2
|
import { render, screen } from '@testing-library/react';
|
12
3
|
import { userEvent } from '@testing-library/user-event';
|
@@ -20,27 +11,27 @@ describe('Single select', () => {
|
|
20
11
|
name: 'Select Options',
|
21
12
|
type: 'choices',
|
22
13
|
};
|
23
|
-
test('returns selected option', () =>
|
14
|
+
test('returns selected option', async () => {
|
24
15
|
const user = userEvent.setup();
|
25
16
|
const onChangeMock = jest.fn((name, value, property) => { });
|
26
17
|
const options = ['option 1', 'option 2', 'option 3'];
|
27
18
|
render(React.createElement(Select, { id: "testSelect", property: choiceProperty, selectOptions: options, onChange: onChangeMock }));
|
28
19
|
const input = screen.getByRole('combobox');
|
29
|
-
|
30
|
-
const option2 =
|
31
|
-
|
20
|
+
await user.click(input);
|
21
|
+
const option2 = await screen.findByRole('option', { name: 'option 2' });
|
22
|
+
await user.click(option2);
|
32
23
|
expect(onChangeMock).toBeCalledWith('selectOptions', expect.objectContaining({ label: 'option 2', value: 'option 2' }), choiceProperty);
|
33
|
-
})
|
34
|
-
test('displays matching options', () =>
|
24
|
+
});
|
25
|
+
test('displays matching options', async () => {
|
35
26
|
const user = userEvent.setup();
|
36
27
|
const options = ['option 1', 'option 2', 'something different'];
|
37
28
|
render(React.createElement(Select, { id: "testSelect", property: choiceProperty, selectOptions: options, onChange: () => { } }));
|
38
29
|
const input = screen.getByRole('combobox');
|
39
|
-
|
40
|
-
|
41
|
-
|
30
|
+
await user.type(input, 'option');
|
31
|
+
await screen.findByRole('option', { name: 'option 1' });
|
32
|
+
await screen.findByRole('option', { name: 'option 2' });
|
42
33
|
expect(screen.queryByRole('option', { name: 'something different' })).not.toBeInTheDocument();
|
43
|
-
})
|
34
|
+
});
|
44
35
|
});
|
45
36
|
describe('Multi select', () => {
|
46
37
|
// Right now an object property is required for this to function, but eventually this should go
|
@@ -50,19 +41,19 @@ describe('Multi select', () => {
|
|
50
41
|
name: 'Select Multiple',
|
51
42
|
type: 'array',
|
52
43
|
};
|
53
|
-
test('returns selected options', () =>
|
44
|
+
test('returns selected options', async () => {
|
54
45
|
const user = userEvent.setup();
|
55
46
|
const onChangeMock = jest.fn((name, value, property) => { });
|
56
47
|
const options = ['option 1', 'option 2', 'option 3'];
|
57
48
|
render(React.createElement(Select, { id: "testSelect", property: multiChoiceProperty, selectOptions: options, onChange: onChangeMock }));
|
58
49
|
const input = screen.getByRole('combobox');
|
59
|
-
|
60
|
-
const option2 =
|
61
|
-
|
62
|
-
|
63
|
-
const option3 =
|
64
|
-
|
50
|
+
await user.click(input);
|
51
|
+
const option2 = await screen.findByRole('option', { name: 'option 2' });
|
52
|
+
await user.click(option2);
|
53
|
+
await user.click(input); // selecting option closes the dropdown, re-open the options
|
54
|
+
const option3 = await screen.findByRole('option', { name: 'option 3' });
|
55
|
+
await user.click(option3);
|
65
56
|
expect(onChangeMock).toBeCalledTimes(2);
|
66
57
|
expect(onChangeMock).lastCalledWith('multiSelect', ['option 2', 'option 3'], multiChoiceProperty);
|
67
|
-
})
|
58
|
+
});
|
68
59
|
});
|
@@ -29,9 +29,9 @@ const TimePickerSelect = (props) => {
|
|
29
29
|
}
|
30
30
|
else if (date instanceof LocalDateTime) {
|
31
31
|
setValue(date);
|
32
|
-
const hour = padStart(date
|
33
|
-
const minute = padStart(date
|
34
|
-
const second = padStart(date
|
32
|
+
const hour = padStart(date?.hour().toString(), 2, '0');
|
33
|
+
const minute = padStart(date?.minute().toString(), 2, '0');
|
34
|
+
const second = padStart(date?.second().toString(), 2, '0');
|
35
35
|
props.onChange(property.id, `${hour}:${minute}:${second}`, property);
|
36
36
|
}
|
37
37
|
else {
|
@@ -40,6 +40,6 @@ const TimePickerSelect = (props) => {
|
|
40
40
|
}
|
41
41
|
};
|
42
42
|
return (React.createElement(LocalizationProvider, null,
|
43
|
-
React.createElement(TimePicker, { value: value, onChange: handleChange, renderInput: (params) => (React.createElement(TextField,
|
43
|
+
React.createElement(TimePicker, { 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', placeholder: placeholder, readOnly: readOnly, ...(additionalProps ?? {}) })), readOnly: readOnly })));
|
44
44
|
};
|
45
45
|
export default TimePickerSelect;
|
@@ -7,37 +7,36 @@ const DisplayedProperty = (props) => {
|
|
7
7
|
const { property, value } = props;
|
8
8
|
const getAddressAsString = (address) => {
|
9
9
|
let stringAddress = '';
|
10
|
-
if (address
|
10
|
+
if (address?.line1)
|
11
11
|
stringAddress = stringAddress.concat(address.line1);
|
12
|
-
if (address
|
12
|
+
if (address?.line2)
|
13
13
|
stringAddress = stringAddress ? stringAddress.concat(' ' + address.line2) : address.line2;
|
14
|
-
if (address
|
14
|
+
if (address?.city)
|
15
15
|
stringAddress = stringAddress ? stringAddress.concat(', ' + address.city) : address.city;
|
16
|
-
if (address
|
16
|
+
if (address?.county)
|
17
17
|
stringAddress = stringAddress ? stringAddress.concat(', ' + address.county) : address.county;
|
18
|
-
if (address
|
18
|
+
if (address?.state)
|
19
19
|
stringAddress = stringAddress ? stringAddress.concat(', ' + address.state) : address.state;
|
20
|
-
if (address
|
20
|
+
if (address?.zipCode)
|
21
21
|
stringAddress = stringAddress ? stringAddress.concat(' ' + address.zipCode) : address.zipCode;
|
22
22
|
return stringAddress;
|
23
23
|
};
|
24
24
|
const formatData = (property, value) => {
|
25
|
-
|
26
|
-
|
27
|
-
return (_a = value === null || value === void 0 ? void 0 : value.name) !== null && _a !== void 0 ? _a : value === null || value === void 0 ? void 0 : value.id;
|
25
|
+
if (property?.objectId) {
|
26
|
+
return value?.name ?? value?.id;
|
28
27
|
}
|
29
|
-
switch (property
|
28
|
+
switch (property?.type) {
|
30
29
|
case 'string':
|
31
30
|
case 'boolean':
|
32
31
|
case 'number':
|
33
32
|
case 'integer':
|
34
|
-
return value
|
33
|
+
return value?.toString();
|
35
34
|
case 'array':
|
36
|
-
return value
|
35
|
+
return value?.toString().replaceAll(',', ', ');
|
37
36
|
case 'address':
|
38
37
|
return getAddressAsString(value);
|
39
38
|
case 'user':
|
40
|
-
return
|
39
|
+
return value?.name ?? value?.id;
|
41
40
|
case 'time':
|
42
41
|
return value
|
43
42
|
? DateTime.fromISO(DateTime.now().toISODate() + 'T' + value).toFormat('hh:mm a')
|
@@ -32,52 +32,56 @@ const styles = {
|
|
32
32
|
const HistoricalData = (props) => {
|
33
33
|
const { records, documentHistory, object } = props;
|
34
34
|
const getPastDocumentVersion = (history) => {
|
35
|
-
|
36
|
-
const
|
37
|
-
const currentVersion = documentVersions === null || documentVersions === void 0 ? void 0 : documentVersions.map((v) => v.timestamp).indexOf(history.timestamp);
|
35
|
+
const documentVersions = documentHistory?.[history.subject?.id ?? 'unknown'] ?? [];
|
36
|
+
const currentVersion = documentVersions?.map((v) => v.timestamp).indexOf(history.timestamp);
|
38
37
|
return currentVersion ? documentVersions[currentVersion - 1] : undefined;
|
39
38
|
};
|
40
|
-
return (React.createElement(Box, { sx: styles.timelineConnector }, records.map((r) => {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
React.createElement(Typography, { sx:
|
81
|
-
|
39
|
+
return (React.createElement(Box, { sx: styles.timelineConnector }, records.map((r) => (React.createElement(Box, { margin: '16px 0px', key: `${r.timestamp}-${nanoid()}` },
|
40
|
+
React.createElement(Box, { sx: { display: 'flex', justifyContent: 'space-between' } },
|
41
|
+
React.createElement(Box, { sx: { display: 'flex', maxWidth: '60%', alignContent: 'flex-start' } },
|
42
|
+
React.createElement(Typography, { sx: { fontSize: '12px', color: '#637381' } },
|
43
|
+
React.createElement(Typography, { component: 'span', sx: { fontWeight: 600, fontSize: '12px' } }, r.user.name ?? 'Unknown User'),
|
44
|
+
"\u00A0",
|
45
|
+
['document', 'correspondence'].includes(r.type) ? lowerCase(r.event) : `- ${r.event}`)),
|
46
|
+
React.createElement(Box, null,
|
47
|
+
React.createElement(Typography, { sx: { fontSize: '12px', color: '#637381' } }, new Date(r.timestamp).getHours() === 12
|
48
|
+
? format(new Date(r.timestamp), 'MMM dd, yyyy H:mm a')
|
49
|
+
: format(new Date(r.timestamp), 'MMM dd, yyyy h:mm a')))),
|
50
|
+
((r.data && r.eventType !== 'create' && r.type === 'instance') ||
|
51
|
+
['document', 'correspondence'].includes(r.type)) && (React.createElement(Box, { sx: {
|
52
|
+
backgroundColor: '#F4F6F8',
|
53
|
+
borderRadius: '4px',
|
54
|
+
paddingTop: r.data?.length ? '4px' : '0px',
|
55
|
+
paddingBottom: r.data?.length ? '4px' : '0px',
|
56
|
+
} },
|
57
|
+
r.type === 'instance' && r.data && (React.createElement(Box, null, r.data.map((d) => {
|
58
|
+
const property = object.properties?.find((p) => p.id === d.property);
|
59
|
+
return (property && (React.createElement(Grid, { container: true, key: property.id, display: "flex", gridTemplateColumns: 'fit-content(25%) fit-content(80%) fit-content(2%) fit-content(80%)', alignItems: "flex-start", justifyContent: "center", sx: {
|
60
|
+
overflowWrap: 'break-word',
|
61
|
+
} },
|
62
|
+
React.createElement(Grid, { item: true, xs: 2 },
|
63
|
+
React.createElement(Typography, { sx: {
|
64
|
+
...styles.historyData,
|
65
|
+
fontWeight: 600,
|
66
|
+
minWidth: 'fit-content',
|
67
|
+
alignSelf: 'flex-start',
|
68
|
+
} }, property.name)),
|
69
|
+
React.createElement(DisplayedProperty, { property: property, value: d.historicalValue }),
|
70
|
+
React.createElement(Grid, { item: true, xs: 0.5 },
|
71
|
+
React.createElement(ArrowForward, { sx: { fontSize: '12px' } })),
|
72
|
+
React.createElement(DisplayedProperty, { property: property, value: d.updatedValue }))));
|
73
|
+
}))),
|
74
|
+
['document', 'correspondence'].includes(r.type) && (React.createElement(Box, null,
|
75
|
+
React.createElement(Box, { display: "grid", gridTemplateColumns: 'fit-content(100%) fit-content(2%) fit-content(100%)', alignItems: "center", sx: { overflowWrap: 'break-word' } },
|
76
|
+
r.type === 'document' &&
|
77
|
+
r.event === 'Uploaded Document Version' &&
|
78
|
+
r.subject?.name !== getPastDocumentVersion(r)?.subject?.name && (React.createElement(React.Fragment, null,
|
79
|
+
React.createElement(Typography, { sx: styles.historyData }, getPastDocumentVersion(r)?.subject?.name),
|
80
|
+
React.createElement(ArrowForward, { sx: { fontSize: '8px' } }))),
|
81
|
+
React.createElement(Typography, { sx: {
|
82
|
+
...styles.historyData,
|
83
|
+
fontWeight: 600,
|
84
|
+
minWidth: 'fit-content',
|
85
|
+
} }, r.subject?.name)))))))))));
|
82
86
|
};
|
83
87
|
export default HistoricalData;
|
@@ -25,15 +25,15 @@ const HistoryLoading = () => {
|
|
25
25
|
React.createElement(Skeleton, { variant: "text", sx: styles.headerSkeleton })),
|
26
26
|
React.createElement(Box, { sx: styles.timelineConnector },
|
27
27
|
React.createElement(Box, { margin: '4px 0px 24px 0px' },
|
28
|
-
React.createElement(Skeleton, { variant: "text", sx:
|
29
|
-
React.createElement(Skeleton, { variant: "text", sx:
|
30
|
-
React.createElement(Skeleton, { variant: "text", sx:
|
28
|
+
React.createElement(Skeleton, { variant: "text", sx: { ...styles.dataSkeleton, width: '120px' } }),
|
29
|
+
React.createElement(Skeleton, { variant: "text", sx: { ...styles.dataSkeleton, width: '65%' } }),
|
30
|
+
React.createElement(Skeleton, { variant: "text", sx: { ...styles.dataSkeleton, width: '75%' } }))),
|
31
31
|
React.createElement(Box, { sx: { display: 'flex', alignItems: 'center' } },
|
32
32
|
React.createElement(Circle, { color: "primary", sx: { fontSize: '12px', marginRight: '12px' } }),
|
33
33
|
React.createElement(Skeleton, { variant: "text", sx: styles.headerSkeleton })),
|
34
34
|
React.createElement(Box, { sx: styles.timelineConnector },
|
35
35
|
React.createElement(Box, { margin: '4px 0px 20px 0px' },
|
36
|
-
React.createElement(Skeleton, { variant: "text", sx:
|
37
|
-
React.createElement(Skeleton, { variant: "text", sx:
|
36
|
+
React.createElement(Skeleton, { variant: "text", sx: { ...styles.dataSkeleton, width: '120px' } }),
|
37
|
+
React.createElement(Skeleton, { variant: "text", sx: { ...styles.dataSkeleton, width: '55%' } })))));
|
38
38
|
};
|
39
39
|
export default HistoryLoading;
|
@@ -35,11 +35,10 @@ export const HistoryLog = (props) => {
|
|
35
35
|
const groupedHistory = {};
|
36
36
|
const documentHistory = {};
|
37
37
|
history.forEach((h) => {
|
38
|
-
var _a, _b, _c, _d, _e, _f;
|
39
38
|
const timestamp = DateTime.fromISO(h.timestamp).toFormat('yyyy-MM-dd');
|
40
|
-
groupedHistory[timestamp] = (
|
39
|
+
groupedHistory[timestamp] = (groupedHistory[timestamp] ?? []).concat(h);
|
41
40
|
if (h.type === 'document') {
|
42
|
-
documentHistory[
|
41
|
+
documentHistory[h.subject?.id ?? 'unknown'] = (documentHistory[h.subject?.id ?? 'unknown'] ?? []).concat(h);
|
43
42
|
}
|
44
43
|
});
|
45
44
|
setHistoryMap(sortGroupedHistoryByDate(groupedHistory, 'desc'));
|
@@ -48,10 +47,10 @@ export const HistoryLog = (props) => {
|
|
48
47
|
}, [history]);
|
49
48
|
useEffect(() => {
|
50
49
|
if (!filter.length) {
|
51
|
-
setFilteredHistory(sortGroupedHistoryByDate(historyMap
|
50
|
+
setFilteredHistory(sortGroupedHistoryByDate(historyMap ?? {}, order));
|
52
51
|
}
|
53
52
|
else {
|
54
|
-
const filtered = Object.fromEntries(Object.entries(historyMap
|
53
|
+
const filtered = Object.fromEntries(Object.entries(historyMap ?? {}).map(([date, historicalData]) => [
|
55
54
|
date,
|
56
55
|
historicalData.filter((r) => filter.includes(r.type)),
|
57
56
|
]));
|
@@ -59,7 +58,7 @@ export const HistoryLog = (props) => {
|
|
59
58
|
}
|
60
59
|
}, [filter, historyMap, order]);
|
61
60
|
useEffect(() => {
|
62
|
-
setFilteredHistory(sortGroupedHistoryByDate(filteredHistory
|
61
|
+
setFilteredHistory(sortGroupedHistoryByDate(filteredHistory ?? {}, order));
|
63
62
|
}, [order]);
|
64
63
|
return (React.createElement(Box, { sx: { margin: '15px 24px 24px 24px' } },
|
65
64
|
!!title && (React.createElement(Box, { sx: { backgroundColor: '#fff', position: 'sticky', top: 0, padding: '15px 0', zIndex: 1400 } },
|
@@ -17,8 +17,8 @@ export default function MenuBar(props) {
|
|
17
17
|
React.createElement(AppBar, { color: "inherit", position: "fixed", elevation: 0, sx: { zIndex: (theme) => theme.zIndex.drawer + 1, borderBottom: '1px solid #919EAB3D' } },
|
18
18
|
React.createElement(Toolbar, { sx: { justifyContent: 'space-between' } },
|
19
19
|
React.createElement(Box, { sx: classes.title }, !props.envName ? (React.createElement(CardMedia, { component: 'img', src: props.logo, alt: props.logoAltText, sx: classes.logo })) : (React.createElement(Box, { mt: 2 },
|
20
|
-
React.createElement(Typography, { variant: "h5" },
|
21
|
-
props
|
20
|
+
React.createElement(Typography, { variant: "h5" },
|
21
|
+
props?.envName,
|
22
22
|
" ")))),
|
23
23
|
props.navItems))));
|
24
24
|
}
|
@@ -51,7 +51,7 @@ export default function MultiSelect(props) {
|
|
51
51
|
const [optionsArray, setOptions] = useState(options);
|
52
52
|
const [selectAll, setSelectAll] = useState(false);
|
53
53
|
const [searchText, setSearchText] = useState('');
|
54
|
-
const [deletedOptions] = useState(options.filter((opt) => opt.deleted).map((opt) =>
|
54
|
+
const [deletedOptions] = useState(options.filter((opt) => opt.deleted).map((opt) => opt.id ?? ''));
|
55
55
|
const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, {
|
56
56
|
coordinateGetter: sortableKeyboardCoordinates,
|
57
57
|
}), useSensor(PointerSensor, {
|
@@ -60,7 +60,7 @@ export default function MultiSelect(props) {
|
|
60
60
|
},
|
61
61
|
}));
|
62
62
|
useEffect(() => {
|
63
|
-
if (optionsArray
|
63
|
+
if (optionsArray?.every((option) => option.value === true)) {
|
64
64
|
setSelectAll(true);
|
65
65
|
}
|
66
66
|
else {
|
@@ -69,13 +69,12 @@ export default function MultiSelect(props) {
|
|
69
69
|
}, [optionsArray]);
|
70
70
|
const handleFlagChange = (event, idOrLabel) => {
|
71
71
|
const newOptions = optionsArray.map((option) => {
|
72
|
-
|
73
|
-
if ((_a = idOrLabel === option.id) !== null && _a !== void 0 ? _a : option.label) {
|
72
|
+
if (idOrLabel === option.id ?? option.label) {
|
74
73
|
option.value = event.target.checked;
|
75
74
|
}
|
76
75
|
return option;
|
77
76
|
});
|
78
|
-
const allOptions = options
|
77
|
+
const allOptions = options?.map((option) => optionsArray.find((o) => o.id === option.id) || option);
|
79
78
|
onChange(allOptions);
|
80
79
|
setOptions(newOptions);
|
81
80
|
};
|
@@ -123,17 +122,16 @@ export default function MultiSelect(props) {
|
|
123
122
|
const { active, over } = event;
|
124
123
|
const items = [...optionsArray];
|
125
124
|
let reOrderedItems = [];
|
126
|
-
if (active.id !==
|
125
|
+
if (active.id !== over?.id) {
|
127
126
|
const oldIndex = items.findIndex((item) => item.id === active.id);
|
128
|
-
const newIndex = items.findIndex((item) => item.id ===
|
127
|
+
const newIndex = items.findIndex((item) => item.id === over?.id);
|
129
128
|
reOrderedItems = arrayMove(items, oldIndex, newIndex);
|
130
129
|
setOptions(reOrderedItems);
|
131
130
|
onChange(reOrderedItems);
|
132
131
|
}
|
133
132
|
};
|
134
133
|
const getToolTip = (option) => {
|
135
|
-
|
136
|
-
return ((_a = options.find((o) => o.id === option.id)) === null || _a === void 0 ? void 0 : _a.disabled) ? option.tooltip : undefined;
|
134
|
+
return options.find((o) => o.id === option.id)?.disabled ? option.tooltip : undefined;
|
137
135
|
};
|
138
136
|
const arrayMove = (items, fromIndex, toIndex) => {
|
139
137
|
const element = items[fromIndex];
|
@@ -165,49 +163,39 @@ export default function MultiSelect(props) {
|
|
165
163
|
startAdornment: (React.createElement(InputAdornment, { position: "start" },
|
166
164
|
React.createElement(Search, null))),
|
167
165
|
}, fullWidth: true, sx: styles.textField, value: searchText, onChange: filterItems }))),
|
168
|
-
|
166
|
+
optionsArray?.length > 1 && (React.createElement(Grid, { container: true },
|
169
167
|
React.createElement(Grid, { item: true, xs: 4, md: 3 },
|
170
|
-
React.createElement(Button, { sx:
|
168
|
+
React.createElement(Button, { sx: { ...styles.button, fontWeight: 'bold' }, variant: "text", onClick: (e) => handleSelectAllChange(e), disabled: optionsArray.every((option) => option.disabled === true || selectAll) }, "Select All")),
|
171
169
|
React.createElement(Grid, { item: true, xs: 8, md: 9 },
|
172
|
-
React.createElement(Button, { sx:
|
170
|
+
React.createElement(Button, { sx: { ...styles.button, fontWeight: 'bold' }, variant: "text", onClick: (e) => handleClearAll(e), disabled: optionsArray.every((option) => option.disabled === true) ||
|
173
171
|
optionsArray.every((option) => option.value === false) }, "Clear All")))),
|
174
|
-
React.createElement(Box, { sx:
|
175
|
-
React.createElement(SortableContext, { items: optionsArray, strategy: verticalListSortingStrategy }, optionsArray.map((option) =>
|
176
|
-
|
177
|
-
|
172
|
+
React.createElement(Box, { sx: { ...styles.list, maxHeight: maxHeight ?? 'auto' } }, isSortable ? (React.createElement(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, modifiers: [restrictToVerticalAxis, restrictToWindowEdges] },
|
173
|
+
React.createElement(SortableContext, { items: optionsArray, strategy: verticalListSortingStrategy }, optionsArray.map((option) => (React.createElement(SortableItem
|
174
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
175
|
+
, {
|
178
176
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
179
|
-
, {
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
React.createElement(Grid, { container: true, justifyContent: "space-between" },
|
204
|
-
React.createElement(Grid, { alignSelf: "center", pl: 1 },
|
205
|
-
React.createElement(Typography, null,
|
206
|
-
" ", option === null || option === void 0 ? void 0 :
|
207
|
-
option.label,
|
208
|
-
" ")),
|
209
|
-
React.createElement(Grid, null,
|
210
|
-
React.createElement(Tooltip, { title: getToolTip(option) },
|
211
|
-
React.createElement(Switch, { sx: styles.disabledSwitch, id: (_b = option === null || option === void 0 ? void 0 : option.id) !== null && _b !== void 0 ? _b : option === null || option === void 0 ? void 0 : option.label, checked: option.value, onChange: (event) => { var _a; return handleFlagChange(event, (_a = option === null || option === void 0 ? void 0 : option.id) !== null && _a !== void 0 ? _a : option === null || option === void 0 ? void 0 : option.label); }, disabled: option.disabled }))))));
|
212
|
-
})))))));
|
177
|
+
Item: (props) => (React.createElement(Grid, { item: true, m: 1, sx: styles.listItem, key: option?.id ?? option?.label },
|
178
|
+
React.createElement(Grid, { container: true, justifyContent: "space-between", wrap: "nowrap" },
|
179
|
+
React.createElement(Grid, { alignSelf: "center", pl: 1, display: "flex", item: true },
|
180
|
+
React.createElement(Box, { sx: styles.dragHandleBox, ref: props.activatorRef, ...props.listeners },
|
181
|
+
React.createElement(IconButton, { size: "medium", sx: styles.dragHandle },
|
182
|
+
React.createElement(DragHandleOutlined, null))),
|
183
|
+
React.createElement(Typography, { sx: { lineHeight: '36px' } },
|
184
|
+
' ',
|
185
|
+
option?.label,
|
186
|
+
' ')),
|
187
|
+
React.createElement(Grid, { item: true },
|
188
|
+
React.createElement(Tooltip, { title: getToolTip(option) },
|
189
|
+
React.createElement(Switch, { sx: styles.disabledSwitch, id: option?.id ?? option?.label, checked: option.value, onChange: (event) => {
|
190
|
+
handleFlagChange(event, option?.id ?? option?.label);
|
191
|
+
}, disabled: option.disabled })))))), key: option?.id ?? option?.label, id: option?.id ?? option?.label })))))) : (React.createElement(React.Fragment, null, sortBy(optionsArray, 'label').map((option) => (React.createElement(Grid, { item: true, m: 1, sx: styles.listItem, key: option?.id ?? option?.label },
|
192
|
+
React.createElement(Grid, { container: true, justifyContent: "space-between" },
|
193
|
+
React.createElement(Grid, { alignSelf: "center", pl: 1 },
|
194
|
+
React.createElement(Typography, null,
|
195
|
+
" ",
|
196
|
+
option?.label,
|
197
|
+
" ")),
|
198
|
+
React.createElement(Grid, null,
|
199
|
+
React.createElement(Tooltip, { title: getToolTip(option) },
|
200
|
+
React.createElement(Switch, { sx: styles.disabledSwitch, id: option?.id ?? option?.label, checked: option.value, onChange: (event) => handleFlagChange(event, option?.id ?? option?.label), disabled: option.disabled })))))))))))));
|
213
201
|
}
|
@@ -12,7 +12,7 @@ export const SortableItem = (props) => {
|
|
12
12
|
transform: CSS.Transform.toString(transform),
|
13
13
|
transition,
|
14
14
|
};
|
15
|
-
return (React.createElement("div",
|
15
|
+
return (React.createElement("div", { ref: setNodeRef, ...attributes },
|
16
16
|
React.createElement(Box, { sx: styles },
|
17
17
|
React.createElement(Item, { activatorRef: setActivatorNodeRef, listeners: listeners }))));
|
18
18
|
};
|