orc-shared 5.8.0-dev.2 → 5.8.0-dev.21
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/actions/applications.js +5 -5
- package/dist/actions/authentication.js +5 -5
- package/dist/actions/countries.js +5 -5
- package/dist/actions/locale.js +5 -5
- package/dist/actions/makeApiAction.js +8 -8
- package/dist/actions/makeOrcApiAction.js +3 -3
- package/dist/actions/metadata.js +8 -8
- package/dist/actions/navigation.js +3 -3
- package/dist/actions/scopes.js +5 -5
- package/dist/actions/tasks.js +5 -5
- package/dist/actions/timezones.js +5 -5
- package/dist/actions/versionInfo.js +5 -5
- package/dist/buildStore.js +5 -5
- package/dist/components/AppFrame/About.js +14 -13
- package/dist/components/AppFrame/Anchor.js +1 -1
- package/dist/components/AppFrame/AppFrame.js +6 -6
- package/dist/components/AppFrame/ApplicationSelector/ApplicationDialog.js +1 -1
- package/dist/components/AppFrame/ApplicationSelector/Header.js +4 -4
- package/dist/components/AppFrame/ApplicationSelector/index.js +3 -3
- package/dist/components/AppFrame/ConnectedToastList.js +2 -2
- package/dist/components/AppFrame/Help.js +1 -1
- package/dist/components/AppFrame/MenuItem.js +6 -6
- package/dist/components/AppFrame/Preferences.js +8 -9
- package/dist/components/AppFrame/Sidebar.js +5 -5
- package/dist/components/AppFrame/Topbar.js +3 -3
- package/dist/components/AppFrame/index.js +2 -2
- package/dist/components/ApplicationModuleLoader.js +5 -5
- package/dist/components/Authenticate.js +2 -2
- package/dist/components/Button.js +1 -1
- package/dist/components/CategoryList.js +6 -6
- package/dist/components/Checkbox.js +5 -5
- package/dist/components/ColumnWrapper.js +1 -1
- package/dist/components/Culture.js +1 -1
- package/dist/components/DevPages.js +1 -1
- package/dist/components/DropMenu/Menu.js +2 -2
- package/dist/components/DropMenu/index.js +5 -5
- package/dist/components/ErrorPlaceholder.js +4 -4
- package/dist/components/Form/Combination.js +2 -2
- package/dist/components/Form/Field.js +3 -3
- package/dist/components/Form/FieldElements.js +4 -4
- package/dist/components/Form/FieldList.js +10 -11
- package/dist/components/Form/Fieldset.js +1 -1
- package/dist/components/Form/Form.js +2 -2
- package/dist/components/Form/FormElement.js +1 -1
- package/dist/components/Form/InputField.js +10 -10
- package/dist/components/Form/Inputs/Button.js +4 -4
- package/dist/components/Form/Inputs/Date.js +4 -4
- package/dist/components/Form/Inputs/FieldButtons.js +2 -2
- package/dist/components/Form/Inputs/Number.js +4 -4
- package/dist/components/Form/Inputs/ReadOnly.js +1 -1
- package/dist/components/Form/Inputs/SmallButton.js +4 -4
- package/dist/components/Form/Inputs/Text.js +4 -5
- package/dist/components/Form/Inputs/Time.js +4 -4
- package/dist/components/Form/Inputs/Toggles.js +4 -4
- package/dist/components/Form/Inputs/Translation.js +12 -12
- package/dist/components/Form/Inputs/index.js +1 -1
- package/dist/components/Form/index.js +2 -2
- package/dist/components/I18n.js +2 -2
- package/dist/components/Icon.js +3 -3
- package/dist/components/IconButton.js +3 -3
- package/dist/components/Input.js +5 -5
- package/dist/components/InternetExplorerWarningMessage.js +1 -1
- package/dist/components/List/DataCell.js +2 -2
- package/dist/components/List/HeadCell.js +2 -2
- package/dist/components/List/HeadRow.js +1 -1
- package/dist/components/List/List.js +5 -5
- package/dist/components/List/Row.js +2 -2
- package/dist/components/List/enhanceColumnDefs.js +3 -3
- package/dist/components/List/index.js +2 -2
- package/dist/components/Loader.js +6 -6
- package/dist/components/LoadingIcon.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/Badge.js +4 -4
- package/dist/components/MaterialUI/DataDisplay/Chip.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/CollapsableList.js +6 -6
- package/dist/components/MaterialUI/DataDisplay/Divider.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/Icon.js +4 -4
- package/dist/components/MaterialUI/DataDisplay/List.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/Modal.js +5 -5
- package/dist/components/MaterialUI/DataDisplay/Notification.js +9 -9
- package/dist/components/MaterialUI/DataDisplay/NotificationProps.js +7 -7
- package/dist/components/MaterialUI/DataDisplay/PopperedElements/PopperedIcon.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ActionModal.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Address.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ConfirmationModal.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/DiscountedPrice.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +24 -14
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.js +4 -4
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/SectionTitle.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +25 -11
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +10 -10
- package/dist/components/MaterialUI/DataDisplay/SelectionList.js +17 -25
- package/dist/components/MaterialUI/DataDisplay/Table.js +9 -9
- package/dist/components/MaterialUI/DataDisplay/TableHeaderCell.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +7 -7
- package/dist/components/MaterialUI/DataDisplay/Timeline.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/TimelineItem.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +7 -7
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedIcon.js +4 -4
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedTypography.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/TransferList.js +10 -10
- package/dist/components/MaterialUI/DataDisplay/chipProps.js +7 -7
- package/dist/components/MaterialUI/DataDisplay/collapsableListProps.js +7 -7
- package/dist/components/MaterialUI/DataDisplay/dividerProps.js +7 -7
- package/dist/components/MaterialUI/DataDisplay/index.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/modalProps.js +7 -7
- package/dist/components/MaterialUI/DataDisplay/tableHelpers.js +9 -5
- package/dist/components/MaterialUI/DataDisplay/useTableSelection.js +7 -7
- package/dist/components/MaterialUI/Feedback/NotificationContext.js +6 -6
- package/dist/components/MaterialUI/Feedback/loadingScreen.js +6 -6
- package/dist/components/MaterialUI/Inputs/Autocomplete.js +6 -6
- package/dist/components/MaterialUI/Inputs/AutocompleteProps.js +7 -7
- package/dist/components/MaterialUI/Inputs/Checkbox.js +5 -5
- package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +5 -5
- package/dist/components/MaterialUI/Inputs/CheckboxGroupProps.js +7 -7
- package/dist/components/MaterialUI/Inputs/CheckboxProps.js +7 -7
- package/dist/components/MaterialUI/Inputs/DatePicker.js +16 -17
- package/dist/components/MaterialUI/Inputs/InputBase.js +15 -12
- package/dist/components/MaterialUI/Inputs/InputBaseProps.js +7 -7
- package/dist/components/MaterialUI/Inputs/LookupSelect.js +3 -3
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +2 -2
- package/dist/components/MaterialUI/Inputs/PredefinedElements/TitledSelect.js +1 -1
- package/dist/components/MaterialUI/Inputs/Radio.js +2 -2
- package/dist/components/MaterialUI/Inputs/RadioProps.js +7 -7
- package/dist/components/MaterialUI/Inputs/Select.js +24 -11
- package/dist/components/MaterialUI/Inputs/SelectProps.js +9 -8
- package/dist/components/MaterialUI/Inputs/StandaloneRadio.js +5 -5
- package/dist/components/MaterialUI/Inputs/Switch.js +33 -21
- package/dist/components/MaterialUI/Inputs/SwitchProps.js +7 -7
- package/dist/components/MaterialUI/Inputs/TimePicker.js +7 -7
- package/dist/components/MaterialUI/Inputs/createInput.js +6 -6
- package/dist/components/MaterialUI/Inputs/index.js +1 -1
- package/dist/components/MaterialUI/Inputs/standaloneRadioProps.js +7 -7
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +6 -6
- package/dist/components/MaterialUI/Navigation/DropDownMenuProps.js +7 -7
- package/dist/components/MaterialUI/Navigation/ExternalLink.js +1 -1
- package/dist/components/MaterialUI/Navigation/PredefinedElements/ActionMenu.js +1 -1
- package/dist/components/MaterialUI/Navigation/TabBar.js +60 -38
- package/dist/components/MaterialUI/Navigation/TabLabel.js +5 -5
- package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -1
- package/dist/components/MaterialUI/ScopeSelector/ScopeTreeView.js +5 -5
- package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +13 -8
- package/dist/components/MaterialUI/Surfaces/ExpansionPanel.js +5 -5
- package/dist/components/MaterialUI/Surfaces/Paper.js +2 -2
- package/dist/components/MaterialUI/Surfaces/PredefinedElements/TitledPaper.js +1 -1
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +5 -5
- package/dist/components/MaterialUI/Surfaces/expansionPanelProps.js +8 -8
- package/dist/components/MaterialUI/Surfaces/paperProps.js +7 -7
- package/dist/components/MaterialUI/componentProps.js +3 -3
- package/dist/components/MaterialUI/hocs/withDeferredPopper.js +10 -16
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +10 -9
- package/dist/components/MaterialUI/muiThemes.js +3 -3
- package/dist/components/MaterialUI/textProps.js +7 -7
- package/dist/components/Modal/Background.js +1 -1
- package/dist/components/Modal/Dialog.js +2 -2
- package/dist/components/Modal/Wrapper.js +2 -2
- package/dist/components/Modal/index.js +6 -6
- package/dist/components/Modules.js +9 -9
- package/dist/components/MultiSelector.js +9 -9
- package/dist/components/Navigation/Bar.js +9 -9
- package/dist/components/Navigation/Tab.js +8 -8
- package/dist/components/Navigation/index.js +2 -1
- package/dist/components/Navigation/useNavigationState.js +9 -9
- package/dist/components/Placeholder.js +5 -5
- package/dist/components/Provision.js +1 -1
- package/dist/components/Routing/FullPage.js +1 -1
- package/dist/components/Routing/Page.js +7 -7
- package/dist/components/Routing/Segment.js +2 -2
- package/dist/components/Routing/SegmentPage.js +11 -11
- package/dist/components/Routing/SubPage.js +5 -5
- package/dist/components/Routing/withWaypointing.js +5 -5
- package/dist/components/Scope/ScopeModificationConfirmationDialog.js +1 -1
- package/dist/components/Scope/ScopeNode.js +6 -6
- package/dist/components/Scope/Selector.js +1 -1
- package/dist/components/Scope/index.js +9 -9
- package/dist/components/Scope/useScopeConfirmationModalState.js +10 -10
- package/dist/components/Scope/useScopeSelect.js +1 -1
- package/dist/components/ScopeExtendedConfigurationLoader.js +5 -5
- package/dist/components/Selector.js +9 -9
- package/dist/components/Sidepanel.js +2 -2
- package/dist/components/Spritesheet.js +1 -1
- package/dist/components/Switch.js +5 -5
- package/dist/components/TaskDetailsModal.js +2 -2
- package/dist/components/Text.js +6 -6
- package/dist/components/ToastList.js +9 -6
- package/dist/components/Toolbar.js +5 -5
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/Treeview/Branch.js +1 -1
- package/dist/components/Treeview/Label.js +2 -2
- package/dist/components/Treeview/Leaf.js +1 -1
- package/dist/components/Treeview/Node.js +7 -7
- package/dist/components/Treeview/index.js +11 -11
- package/dist/constants.js +7 -1
- package/dist/getThemeOverrides.js +3 -3
- package/dist/hocs/withAuthentication.js +2 -2
- package/dist/hocs/withClickOutside.js +4 -4
- package/dist/hocs/withErrorBoundary.js +7 -7
- package/dist/hocs/withId.js +4 -4
- package/dist/hocs/withNavigationLink.js +5 -5
- package/dist/hocs/withScopeData.js +5 -5
- package/dist/hocs/withScrollBox.js +4 -4
- package/dist/hocs/withToggle.js +8 -8
- package/dist/hocs/withUpdateHandler.js +3 -3
- package/dist/hocs/withViewState.js +5 -5
- package/dist/hooks/useEditState.js +3 -3
- package/dist/hooks/useEntityLoader.js +8 -8
- package/dist/hooks/useFullEntityEditState.js +8 -8
- package/dist/hooks/useInfiniteScroll.js +4 -4
- package/dist/hooks/useLabelMessage.js +4 -4
- package/dist/hooks/useMultipleFieldEditState.js +3 -3
- package/dist/hooks/useNotificationRequestState.js +4 -4
- package/dist/hooks/useRequestState.js +1 -1
- package/dist/hooks/useScopeGuardLoader.js +1 -1
- package/dist/hooks/useSelectorAndUnwrap.js +1 -1
- package/dist/hooks/useToggle.js +4 -4
- package/dist/reducers/applications.js +1 -1
- package/dist/reducers/authentication.js +5 -5
- package/dist/reducers/countries.js +1 -1
- package/dist/reducers/globalErrorMessages.js +1 -1
- package/dist/reducers/localeFactory.js +1 -1
- package/dist/reducers/metadata.js +18 -10
- package/dist/reducers/modules.js +1 -1
- package/dist/reducers/navigation.js +1 -1
- package/dist/reducers/request.js +1 -1
- package/dist/reducers/requestStates.js +1 -1
- package/dist/reducers/scopeRouteState.js +1 -1
- package/dist/reducers/scopes.js +1 -1
- package/dist/reducers/scopesExtendedConfiguration.js +1 -1
- package/dist/reducers/settings.js +1 -1
- package/dist/reducers/tasks.js +1 -1
- package/dist/reducers/timezones.js +1 -1
- package/dist/reducers/toasts.js +1 -1
- package/dist/reducers/versionInfo.js +1 -1
- package/dist/reducers/view.js +1 -1
- package/dist/selectors/locale.js +1 -1
- package/dist/selectors/metadata.js +4 -4
- package/dist/selectors/modules.js +3 -3
- package/dist/selectors/navigation.js +1 -1
- package/dist/selectors/route.js +1 -1
- package/dist/selectors/scope.js +1 -1
- package/dist/selectors/tasks.js +1 -1
- package/dist/utils/buildUrl.js +19 -5
- package/dist/utils/filterHelper.js +4 -2
- package/dist/utils/flatten.js +7 -7
- package/dist/utils/index.js +1 -1
- package/dist/utils/inputHelper.js +71 -0
- package/dist/utils/logPass.js +1 -1
- package/dist/utils/memoize.js +1 -1
- package/dist/utils/modelValidationHelper.js +3 -3
- package/dist/utils/normalizeForSearch.js +4 -1
- package/dist/utils/propertyBagHelper.js +4 -4
- package/dist/utils/propertyHelper.js +6 -6
- package/dist/utils/propertyValidator.js +1 -1
- package/dist/utils/setTranslation.js +3 -3
- package/dist/utils/setTranslationWithFallback.js +3 -3
- package/dist/utils/stripKey.js +4 -4
- package/dist/utils/styledPropFuncs.js +1 -1
- package/dist/utils/testUtils.js +8 -5
- package/dist/utils/timezoneHelper.js +6 -6
- package/dist/utils/unwrapImmutable.js +1 -1
- package/dist/utils/urlHelper.js +3 -3
- package/dist/whyDidYouRerender.js +1 -1
- package/package.json +2 -5
- package/src/components/AppFrame/About.js +4 -3
- package/src/components/AppFrame/About.test.js +61 -0
- package/src/components/AppFrame/ConnectedToastList.test.js +3 -1
- package/src/components/DropMenu/DropMenu.test.js +2 -0
- package/src/components/Form/InputField.js +1 -1
- package/src/components/Form/InputField.test.js +1 -1
- package/src/components/MaterialUI/DataDisplay/Badge.js +1 -1
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +29 -8
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.test.js +18 -6
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +27 -6
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.test.js +202 -0
- package/src/components/MaterialUI/DataDisplay/SelectionList.js +6 -20
- package/src/components/MaterialUI/DataDisplay/SelectionList.test.js +0 -6
- package/src/components/MaterialUI/DataDisplay/tableHelpers.js +14 -4
- package/src/components/MaterialUI/Feedback/loadingScreen.test.js +1 -0
- package/src/components/MaterialUI/Feedback/useNotification.test.js +1 -0
- package/src/components/MaterialUI/Inputs/DatePicker.js +16 -4
- package/src/components/MaterialUI/Inputs/DatePicker.test.js +35 -1
- package/src/components/MaterialUI/Inputs/InputBase.js +2 -0
- package/src/components/MaterialUI/Inputs/InputBase.test.js +49 -0
- package/src/components/MaterialUI/Inputs/Select.js +13 -1
- package/src/components/MaterialUI/Inputs/Select.test.js +37 -0
- package/src/components/MaterialUI/Inputs/SelectProps.js +1 -0
- package/src/components/MaterialUI/Inputs/Switch.js +28 -6
- package/src/components/MaterialUI/Inputs/Switch.test.js +39 -0
- package/src/components/MaterialUI/Navigation/TabBar.js +55 -34
- package/src/components/MaterialUI/ScopeSelector/TreeItem.js +6 -2
- package/src/components/MaterialUI/ScopeSelector/TreeItem.test.js +39 -0
- package/src/components/MaterialUI/hocs/withDeferredPopper.js +1 -4
- package/src/components/MaterialUI/hocs/withDeferredPopper.test.js +2 -0
- package/src/components/Modal/Modal.test.js +3 -1
- package/src/components/Modal/Wrapper.test.js +3 -1
- package/src/components/Routing/SegmentPage.js +2 -1
- package/src/components/Scope/Scope.test.js +3 -1
- package/src/components/Sidepanel.test.js +3 -1
- package/src/components/ToastList.js +2 -2
- package/src/constants.js +5 -0
- package/src/hocs/withErrorBoundary.test.js +4 -3
- package/src/hooks/useEditState.test.js +2 -0
- package/src/hooks/useLabelMessage.test.js +2 -0
- package/src/reducers/metadata.js +12 -17
- package/src/reducers/metadata.test.js +318 -156
- package/src/utils/buildUrl.js +15 -0
- package/src/utils/buildUrl.test.js +27 -1
- package/src/utils/filterHelper.js +4 -2
- package/src/utils/filterHelper.test.js +6 -6
- package/src/utils/inputHelper.js +22 -0
- package/src/utils/inputHelper.test.js +47 -0
- package/src/utils/normalizeForSearch.js +2 -0
- package/src/utils/propertyBagHelper.js +6 -3
- package/src/utils/propertyHelper.js +6 -6
- package/src/utils/testUtils.js +25 -22
- package/src/utils/testUtils.test.js +4 -4
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
2
3
|
import SwitchMui from "@material-ui/core/Switch";
|
|
3
4
|
import { makeStyles } from "@material-ui/core/styles";
|
|
4
5
|
import SwitchProps, { isSwitchProps } from "./SwitchProps";
|
|
@@ -21,13 +22,19 @@ export const useStyles = makeStyles(theme => ({
|
|
|
21
22
|
input: {
|
|
22
23
|
left: "-250%",
|
|
23
24
|
width: "600%",
|
|
24
|
-
cursor:
|
|
25
|
+
cursor: "inherit",
|
|
26
|
+
},
|
|
27
|
+
inputReadOnly: {
|
|
28
|
+
cursor: "default",
|
|
25
29
|
},
|
|
26
30
|
thumb: {
|
|
27
31
|
width: theme.spacing(1.3),
|
|
28
32
|
height: theme.spacing(1.3),
|
|
29
33
|
backgroundColor: theme.palette.background.default,
|
|
30
|
-
display:
|
|
34
|
+
display: "inherit",
|
|
35
|
+
},
|
|
36
|
+
thumbReadOnly: {
|
|
37
|
+
display: "none",
|
|
31
38
|
},
|
|
32
39
|
track: {
|
|
33
40
|
backgroundColor: theme.palette.grey.borders,
|
|
@@ -45,13 +52,19 @@ export const useStyles = makeStyles(theme => ({
|
|
|
45
52
|
"&:before": {
|
|
46
53
|
content: props => `"${props.formattedOnCaption}"`,
|
|
47
54
|
left: theme.spacing(0.9),
|
|
48
|
-
right: props => props.readOnly && theme.spacing(0.9),
|
|
49
55
|
opacity: 0,
|
|
50
56
|
},
|
|
51
57
|
"&:after": {
|
|
52
58
|
content: props => `"${props.formattedOffCaption}"`,
|
|
53
59
|
right: theme.spacing(0.9),
|
|
54
|
-
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
trackReadOnly: {
|
|
63
|
+
"&:before": {
|
|
64
|
+
right: theme.spacing(0.9),
|
|
65
|
+
},
|
|
66
|
+
"&:after": {
|
|
67
|
+
left: theme.spacing(0.9),
|
|
55
68
|
},
|
|
56
69
|
},
|
|
57
70
|
checked: {
|
|
@@ -95,8 +108,17 @@ const Switch = ({ switchProps }) => {
|
|
|
95
108
|
const formattedOnCaption = onCaption != null ? formatMessage(onCaption) : "";
|
|
96
109
|
const formattedOffCaption = offCaption != null ? formatMessage(offCaption) : "";
|
|
97
110
|
|
|
98
|
-
const classes = useStyles({ formattedOnCaption, formattedOffCaption
|
|
99
|
-
const switchClasses = {
|
|
111
|
+
const classes = useStyles({ formattedOnCaption, formattedOffCaption });
|
|
112
|
+
const switchClasses = {
|
|
113
|
+
root: classes.root,
|
|
114
|
+
switchBase: classes.switchBase,
|
|
115
|
+
input: classNames(classes.input, { [classes.inputReadOnly]: readOnly }),
|
|
116
|
+
thumb: classNames(classes.thumb, { [classes.thumbReadOnly]: readOnly }),
|
|
117
|
+
track: classNames(classes.track, { [classes.trackReadOnly]: readOnly }),
|
|
118
|
+
checked: classes.checked,
|
|
119
|
+
disabled: classes.disabled,
|
|
120
|
+
...className,
|
|
121
|
+
};
|
|
100
122
|
|
|
101
123
|
return (
|
|
102
124
|
<SwitchMui
|
|
@@ -6,6 +6,9 @@ import { ignoreConsoleError } from "../../../utils/testUtils";
|
|
|
6
6
|
import SwitchProps from "./SwitchProps";
|
|
7
7
|
import Switch from "./Switch";
|
|
8
8
|
import { IntlProvider } from "react-intl";
|
|
9
|
+
import { StylesProvider } from "@material-ui/core/styles";
|
|
10
|
+
import { MuiThemeProvider } from "@material-ui/core";
|
|
11
|
+
import { generateClassName, createMuiTheme } from "~/utils/testUtils";
|
|
9
12
|
|
|
10
13
|
const messages = {
|
|
11
14
|
captionOn: "is On",
|
|
@@ -77,6 +80,42 @@ describe("Switch Component", () => {
|
|
|
77
80
|
expect(update, "to have calls satisfying", [{ args: [true, {}] }]);
|
|
78
81
|
});
|
|
79
82
|
|
|
83
|
+
it("Renders readonly switch with readonly styles", () => {
|
|
84
|
+
const switchProps = new SwitchProps();
|
|
85
|
+
switchProps.set(SwitchProps.propNames.readOnly, true);
|
|
86
|
+
const component = (
|
|
87
|
+
<IntlProvider locale="en-US">
|
|
88
|
+
<StylesProvider generateClassName={generateClassName}>
|
|
89
|
+
<MuiThemeProvider theme={createMuiTheme()}>
|
|
90
|
+
<Switch switchProps={switchProps} />
|
|
91
|
+
</MuiThemeProvider>
|
|
92
|
+
</StylesProvider>
|
|
93
|
+
</IntlProvider>
|
|
94
|
+
);
|
|
95
|
+
const mountedComponent = mount(component);
|
|
96
|
+
expect(mountedComponent.exists(".makeStyles-inputReadOnly"), "to be true");
|
|
97
|
+
expect(mountedComponent.exists(".makeStyles-thumbReadOnly"), "to be true");
|
|
98
|
+
expect(mountedComponent.exists(".makeStyles-trackReadOnly"), "to be true");
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("Renders updatable switch with updatable styles", () => {
|
|
102
|
+
const switchProps = new SwitchProps();
|
|
103
|
+
switchProps.set(SwitchProps.propNames.readOnly, false);
|
|
104
|
+
const component = (
|
|
105
|
+
<IntlProvider locale="en-US">
|
|
106
|
+
<StylesProvider generateClassName={generateClassName}>
|
|
107
|
+
<MuiThemeProvider theme={createMuiTheme()}>
|
|
108
|
+
<Switch switchProps={switchProps} />
|
|
109
|
+
</MuiThemeProvider>
|
|
110
|
+
</StylesProvider>
|
|
111
|
+
</IntlProvider>
|
|
112
|
+
);
|
|
113
|
+
const mountedComponent = mount(component);
|
|
114
|
+
expect(mountedComponent.exists(".makeStyles-inputReadOnly"), "to be false");
|
|
115
|
+
expect(mountedComponent.exists(".makeStyles-thumbReadOnly"), "to be false");
|
|
116
|
+
expect(mountedComponent.exists(".makeStyles-trackReadOnly"), "to be false");
|
|
117
|
+
});
|
|
118
|
+
|
|
80
119
|
it("Checkbox component handles uncheck", () => {
|
|
81
120
|
const switchProps = new SwitchProps();
|
|
82
121
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
2
|
import { FormattedMessage } from "react-intl";
|
|
3
3
|
import { useHistory } from "react-router-dom";
|
|
4
4
|
import { Link } from "react-router-dom";
|
|
@@ -100,6 +100,21 @@ export const TabLink = React.forwardRef((props, ref) => {
|
|
|
100
100
|
);
|
|
101
101
|
});
|
|
102
102
|
|
|
103
|
+
const createEntityId = (entityIdResolver, params, href, path) => {
|
|
104
|
+
let entityIdKey = Object.keys(params).find(p => p.toLowerCase().endsWith("id"));
|
|
105
|
+
if (!entityIdKey) entityIdKey = tryGetNewEntityIdKey(href);
|
|
106
|
+
|
|
107
|
+
const entityId =
|
|
108
|
+
typeof entityIdResolver === "function"
|
|
109
|
+
? entityIdResolver({ match: { params } })
|
|
110
|
+
: resolveEntityId(href, path, entityIdKey);
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
entityId,
|
|
114
|
+
entityIdKey,
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
|
|
103
118
|
const MuiBar = ({ module, moduleName, pages }) => {
|
|
104
119
|
const tabs = React.useRef(null);
|
|
105
120
|
const classes = useStyles();
|
|
@@ -122,14 +137,17 @@ const MuiBar = ({ module, moduleName, pages }) => {
|
|
|
122
137
|
|
|
123
138
|
const tabLabels = [];
|
|
124
139
|
|
|
125
|
-
const handleChange = (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
140
|
+
const handleChange = useCallback(
|
|
141
|
+
(_, value) => {
|
|
142
|
+
if (typeof value === "number" && value >= 0 && value < pages.length) {
|
|
143
|
+
const href = pages[value].href;
|
|
144
|
+
history.push(href);
|
|
145
|
+
} else {
|
|
146
|
+
history.push(module.href);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
[history, module, pages],
|
|
150
|
+
);
|
|
133
151
|
|
|
134
152
|
const selectProps = new SelectProps();
|
|
135
153
|
selectProps.set(SelectProps.propNames.iconSelect, true);
|
|
@@ -142,10 +160,13 @@ const MuiBar = ({ module, moduleName, pages }) => {
|
|
|
142
160
|
</div>
|
|
143
161
|
);
|
|
144
162
|
|
|
145
|
-
const getNewIndex =
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
163
|
+
const getNewIndex = useCallback(
|
|
164
|
+
oldIndex => {
|
|
165
|
+
const newIndex = oldIndex + 1 >= tabLabels.length ? oldIndex - 1 : oldIndex + 1;
|
|
166
|
+
return newIndex;
|
|
167
|
+
},
|
|
168
|
+
[tabLabels.length],
|
|
169
|
+
);
|
|
149
170
|
|
|
150
171
|
const tabCloseHandler = (event, closeCallback, isModified, href, path, entityIdKey, entityId, index) => {
|
|
151
172
|
event.stopPropagation();
|
|
@@ -178,8 +199,6 @@ const MuiBar = ({ module, moduleName, pages }) => {
|
|
|
178
199
|
resizeHandler();
|
|
179
200
|
}, [resizeHandler, module, pages]);
|
|
180
201
|
|
|
181
|
-
const closingActions = [];
|
|
182
|
-
|
|
183
202
|
const allTabs = (
|
|
184
203
|
<div className={classes.container}>
|
|
185
204
|
<ResizeDetector onResize={resizeHandler} />
|
|
@@ -208,12 +227,7 @@ const MuiBar = ({ module, moduleName, pages }) => {
|
|
|
208
227
|
{ href, label, outsideScope, close, path, params, mustTruncate, icon, isDetails, entityIdResolver },
|
|
209
228
|
index,
|
|
210
229
|
) => {
|
|
211
|
-
|
|
212
|
-
if (!entityIdKey) entityIdKey = tryGetNewEntityIdKey(href);
|
|
213
|
-
const entityId =
|
|
214
|
-
typeof entityIdResolver === "function"
|
|
215
|
-
? entityIdResolver({ match: { params } })
|
|
216
|
-
: resolveEntityId(href, path, entityIdKey);
|
|
230
|
+
const { entityId, entityIdKey } = createEntityId(entityIdResolver, params, href, path);
|
|
217
231
|
const isModified = modifiedTabs.includes(href);
|
|
218
232
|
const isError = tabsWithErrors.includes(href);
|
|
219
233
|
const tabLabel = <TabLabel label={label} />;
|
|
@@ -244,18 +258,6 @@ const MuiBar = ({ module, moduleName, pages }) => {
|
|
|
244
258
|
sortOrder: index,
|
|
245
259
|
});
|
|
246
260
|
|
|
247
|
-
if (entityId != null) {
|
|
248
|
-
closingActions.push({
|
|
249
|
-
entityId: entityId,
|
|
250
|
-
closeTab: (event, executeHandlerOnly = false) => {
|
|
251
|
-
close(event, executeHandlerOnly);
|
|
252
|
-
if (executeHandlerOnly === false) {
|
|
253
|
-
handleChange(null, getNewIndex(index));
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
261
|
return (
|
|
260
262
|
<Tab
|
|
261
263
|
classes={{
|
|
@@ -286,8 +288,27 @@ const MuiBar = ({ module, moduleName, pages }) => {
|
|
|
286
288
|
);
|
|
287
289
|
|
|
288
290
|
React.useEffect(() => {
|
|
291
|
+
const closingActions = [];
|
|
292
|
+
|
|
293
|
+
pages.forEach((page, index) => {
|
|
294
|
+
const { href, close, path, params, entityIdResolver } = page;
|
|
295
|
+
const { entityId } = createEntityId(entityIdResolver, params, href, path);
|
|
296
|
+
|
|
297
|
+
if (entityId != null) {
|
|
298
|
+
closingActions.push({
|
|
299
|
+
entityId: entityId,
|
|
300
|
+
closeTab: (event, executeHandlerOnly = false) => {
|
|
301
|
+
close(event, executeHandlerOnly);
|
|
302
|
+
if (executeHandlerOnly === false) {
|
|
303
|
+
handleChange(null, getNewIndex(index));
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
|
|
289
310
|
dispatchRedux(setClosingTabHandlerActions(moduleName, closingActions));
|
|
290
|
-
}, [dispatchRedux, moduleName,
|
|
311
|
+
}, [dispatchRedux, getNewIndex, handleChange, moduleName, pages]);
|
|
291
312
|
|
|
292
313
|
return allTabs;
|
|
293
314
|
};
|
|
@@ -34,6 +34,9 @@ const useStyles = makeStyles(theme => ({
|
|
|
34
34
|
display: "flex",
|
|
35
35
|
alignItems: "center",
|
|
36
36
|
},
|
|
37
|
+
scopeLabelInactive: {
|
|
38
|
+
color: theme.palette.secondary.light,
|
|
39
|
+
},
|
|
37
40
|
scopeIcon: {
|
|
38
41
|
marginRight: theme.spacing(0.7),
|
|
39
42
|
height: theme.spacing(2.4),
|
|
@@ -102,7 +105,7 @@ export const ScopeIcon = ({ type }) => {
|
|
|
102
105
|
}
|
|
103
106
|
};
|
|
104
107
|
|
|
105
|
-
export const ScopeLabel = ({ name, type, isRootScope, hasChildren, isVirtualScope }) => {
|
|
108
|
+
export const ScopeLabel = ({ name, type, isRootScope, hasChildren, isVirtualScope, isActive = true }) => {
|
|
106
109
|
const classes = useStyles({ hasChildren });
|
|
107
110
|
|
|
108
111
|
const icon = <ScopeIcon type={type} />;
|
|
@@ -116,7 +119,7 @@ export const ScopeLabel = ({ name, type, isRootScope, hasChildren, isVirtualScop
|
|
|
116
119
|
// 16.8 height of 1 lines of text
|
|
117
120
|
|
|
118
121
|
const label = (
|
|
119
|
-
<div className={classes.scopeLabel}>
|
|
122
|
+
<div className={classNames(classes.scopeLabel, isActive === false ? classes.scopeLabelInactive : "")}>
|
|
120
123
|
{icon}
|
|
121
124
|
<MultipleLinesText textProps={multipleLinesTextProps} children={name} />
|
|
122
125
|
</div>
|
|
@@ -153,6 +156,7 @@ const TreeItem = ({ scope, rootId, onScopeSelect, isScopeSelectable, children })
|
|
|
153
156
|
isRootScope={isRootScope}
|
|
154
157
|
isVirtualScope={isVirtualScope}
|
|
155
158
|
hasChildren={hasChildren}
|
|
159
|
+
isActive={scope.isActive}
|
|
156
160
|
/>
|
|
157
161
|
}
|
|
158
162
|
expandIcon={isRootScope ? null : expandIcon}
|
|
@@ -50,6 +50,14 @@ describe("TreeItem", () => {
|
|
|
50
50
|
children: ["TestSale"],
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
const inActiveScope = {
|
|
54
|
+
id: "TestInactive",
|
|
55
|
+
name: "Test Inactive",
|
|
56
|
+
type: scopeTypes.sale,
|
|
57
|
+
children: [],
|
|
58
|
+
isActive: false,
|
|
59
|
+
};
|
|
60
|
+
|
|
53
61
|
const saleScope = {
|
|
54
62
|
id: "TestSale",
|
|
55
63
|
name: "Test Sale",
|
|
@@ -109,6 +117,37 @@ describe("TreeItem", () => {
|
|
|
109
117
|
expect(component, "when mounted", "to satisfy", expected);
|
|
110
118
|
});
|
|
111
119
|
|
|
120
|
+
it("Renders Tree Item correctly for not active Scope", () => {
|
|
121
|
+
const expectedVirtualLabel = (
|
|
122
|
+
<ScopeLabel
|
|
123
|
+
name={inActiveScope.name}
|
|
124
|
+
type={inActiveScope.type}
|
|
125
|
+
isRootScope={false}
|
|
126
|
+
isVirtualScope={false}
|
|
127
|
+
isActive={false}
|
|
128
|
+
/>
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
const component = (
|
|
132
|
+
<TestWrapper provider={{ store }} memoryRouter stylesProvider muiThemeProvider={{ theme }}>
|
|
133
|
+
<TreeItem scope={inActiveScope} rootId={rootId} />
|
|
134
|
+
</TestWrapper>
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
const expected = (
|
|
138
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
139
|
+
<TreeItemMui
|
|
140
|
+
nodeId={inActiveScope.id}
|
|
141
|
+
label={expectedVirtualLabel}
|
|
142
|
+
expandIcon={expandIcon}
|
|
143
|
+
collapseIcon={collapseIcon}
|
|
144
|
+
/>
|
|
145
|
+
</TestWrapper>
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
expect(component, "when mounted", "to satisfy", expected);
|
|
149
|
+
});
|
|
150
|
+
|
|
112
151
|
it("Calls scope select handler on label click if scope type is not virtual", () => {
|
|
113
152
|
const component = (
|
|
114
153
|
<TestWrapper provider={{ store }} memoryRouter stylesProvider muiThemeProvider={{ theme }}>
|
|
@@ -78,16 +78,13 @@ const withDeferredPopper =
|
|
|
78
78
|
const defaultComponent = <Comp onClick={event => togglePopper(event)} {...props} />;
|
|
79
79
|
|
|
80
80
|
const togglePopper = function (event) {
|
|
81
|
-
const linkParent = event?._dispatchInstances?.filter(item => item.elementType === "a");
|
|
82
|
-
if (linkParent) {
|
|
83
|
-
event.preventDefault();
|
|
84
|
-
}
|
|
85
81
|
const isDisplayed = !popperState.isDisplayed;
|
|
86
82
|
const anchorElement = event.currentTarget;
|
|
87
83
|
setPopperState({
|
|
88
84
|
isDisplayed: isDisplayed,
|
|
89
85
|
anchorElement: anchorElement,
|
|
90
86
|
});
|
|
87
|
+
event.preventDefault();
|
|
91
88
|
event.bubbles = false;
|
|
92
89
|
event.stopPropagation();
|
|
93
90
|
};
|
|
@@ -265,6 +265,7 @@ describe("withDeferredPopper", () => {
|
|
|
265
265
|
ignoreConsoleError(() => {
|
|
266
266
|
const event = {
|
|
267
267
|
currentTarget: wrapper,
|
|
268
|
+
preventDefault: jest.fn(),
|
|
268
269
|
stopPropagation: jest.fn(),
|
|
269
270
|
};
|
|
270
271
|
|
|
@@ -296,6 +297,7 @@ describe("withDeferredPopper", () => {
|
|
|
296
297
|
ignoreConsoleError(() => {
|
|
297
298
|
const event = {
|
|
298
299
|
currentTarget: null,
|
|
300
|
+
preventDefault: jest.fn(),
|
|
299
301
|
stopPropagation: jest.fn(),
|
|
300
302
|
};
|
|
301
303
|
|
|
@@ -64,6 +64,7 @@ export const List = styled.div`
|
|
|
64
64
|
border-right: 1px solid ${getThemeProp(["colors", "borderLight"], "#cccccc")};
|
|
65
65
|
display: flex;
|
|
66
66
|
flex-direction: column;
|
|
67
|
+
overflow-y: auto;
|
|
67
68
|
`;
|
|
68
69
|
|
|
69
70
|
const FilteredLink = ({ active, ...props }) => (props.to ? <Link {...props} /> : <div {...props} />);
|
|
@@ -167,7 +168,7 @@ const SegmentPage = ({
|
|
|
167
168
|
modulePrependPath,
|
|
168
169
|
entityIdResolver,
|
|
169
170
|
}) => {
|
|
170
|
-
const classes = useStyles({ isComponentNull:
|
|
171
|
+
const classes = useStyles({ isComponentNull: !View });
|
|
171
172
|
const pattern = new UrlPattern(path);
|
|
172
173
|
const baseHref = pattern.stringify(match.params);
|
|
173
174
|
const pages = [],
|
|
@@ -121,7 +121,9 @@ beforeEach(() => {
|
|
|
121
121
|
afterEach(() => {
|
|
122
122
|
try {
|
|
123
123
|
ReactDOM.unmountComponentAtNode(appRoot);
|
|
124
|
-
} catch
|
|
124
|
+
} catch {
|
|
125
|
+
// don't do anything
|
|
126
|
+
}
|
|
125
127
|
document.body.removeChild(appRoot);
|
|
126
128
|
document.body.removeChild(modalRoot);
|
|
127
129
|
});
|
|
@@ -104,8 +104,8 @@ const ListWrapper = styled(TransitionGroup)`
|
|
|
104
104
|
export const ToastList = ({ toasts }) =>
|
|
105
105
|
ReactDOM.createPortal(
|
|
106
106
|
<ListWrapper>
|
|
107
|
-
{toasts.map(props => (
|
|
108
|
-
<Toast {...props} />
|
|
107
|
+
{toasts.map((props, idx) => (
|
|
108
|
+
<Toast key={"toast" + idx} {...props} />
|
|
109
109
|
))}
|
|
110
110
|
</ListWrapper>,
|
|
111
111
|
portal,
|
package/src/constants.js
CHANGED
|
@@ -28,9 +28,10 @@ describe("withErrorBoundary", () => {
|
|
|
28
28
|
{ args: ["Caught an error: Fail, at boundary Failed"] },
|
|
29
29
|
{
|
|
30
30
|
args: [
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
31
|
+
expect.it(
|
|
32
|
+
"to match",
|
|
33
|
+
/at FailBall.*withErrorBoundary\.test\.js.*at ErrorBoundary.*withErrorBoundary\.js.*at BoundedFailBall/s,
|
|
34
|
+
),
|
|
34
35
|
],
|
|
35
36
|
},
|
|
36
37
|
]);
|
package/src/reducers/metadata.js
CHANGED
|
@@ -156,33 +156,28 @@ const metadataReducer = (state = initialState, action) => {
|
|
|
156
156
|
}
|
|
157
157
|
case SAVE_ORDER_LOOKUP_SUCCESS:
|
|
158
158
|
case GET_ORDER_LOOKUP_SUCCESS:
|
|
159
|
-
return
|
|
160
|
-
[
|
|
161
|
-
|
|
162
|
-
);
|
|
159
|
+
return lookupReducerHelper.getLookupsQuerySuccess(ORDER_MODULE_NAME, state, {
|
|
160
|
+
payload: [action.payload],
|
|
161
|
+
});
|
|
163
162
|
|
|
164
163
|
case ADD_ORDER_LOOKUP_SUCCESS: {
|
|
165
|
-
state =
|
|
166
|
-
[
|
|
167
|
-
|
|
168
|
-
);
|
|
164
|
+
state = lookupReducerHelper.getLookupsQuerySuccess(ORDER_MODULE_NAME, state, {
|
|
165
|
+
payload: [action.payload],
|
|
166
|
+
});
|
|
169
167
|
|
|
170
168
|
return lookupReducerHelper.getPagedLookups(ORDER_MODULE_NAME, state);
|
|
171
169
|
}
|
|
172
170
|
|
|
173
171
|
case SAVE_CUSTOMER_LOOKUP_SUCCESS:
|
|
174
172
|
case GET_CUSTOMER_LOOKUP_SUCCESS:
|
|
175
|
-
return
|
|
176
|
-
[
|
|
177
|
-
|
|
178
|
-
);
|
|
173
|
+
return lookupReducerHelper.getLookupsQuerySuccess(CUSTOMER_MODULE_NAME, state, {
|
|
174
|
+
payload: [action.payload],
|
|
175
|
+
});
|
|
179
176
|
|
|
180
177
|
case ADD_CUSTOMER_LOOKUP_SUCCESS: {
|
|
181
|
-
state =
|
|
182
|
-
[
|
|
183
|
-
|
|
184
|
-
);
|
|
185
|
-
|
|
178
|
+
state = lookupReducerHelper.getLookupsQuerySuccess(CUSTOMER_MODULE_NAME, state, {
|
|
179
|
+
payload: [action.payload],
|
|
180
|
+
});
|
|
186
181
|
return lookupReducerHelper.getPagedLookups(CUSTOMER_MODULE_NAME, state);
|
|
187
182
|
}
|
|
188
183
|
|