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.
Files changed (318) hide show
  1. package/dist/actions/applications.js +5 -5
  2. package/dist/actions/authentication.js +5 -5
  3. package/dist/actions/countries.js +5 -5
  4. package/dist/actions/locale.js +5 -5
  5. package/dist/actions/makeApiAction.js +8 -8
  6. package/dist/actions/makeOrcApiAction.js +3 -3
  7. package/dist/actions/metadata.js +8 -8
  8. package/dist/actions/navigation.js +3 -3
  9. package/dist/actions/scopes.js +5 -5
  10. package/dist/actions/tasks.js +5 -5
  11. package/dist/actions/timezones.js +5 -5
  12. package/dist/actions/versionInfo.js +5 -5
  13. package/dist/buildStore.js +5 -5
  14. package/dist/components/AppFrame/About.js +14 -13
  15. package/dist/components/AppFrame/Anchor.js +1 -1
  16. package/dist/components/AppFrame/AppFrame.js +6 -6
  17. package/dist/components/AppFrame/ApplicationSelector/ApplicationDialog.js +1 -1
  18. package/dist/components/AppFrame/ApplicationSelector/Header.js +4 -4
  19. package/dist/components/AppFrame/ApplicationSelector/index.js +3 -3
  20. package/dist/components/AppFrame/ConnectedToastList.js +2 -2
  21. package/dist/components/AppFrame/Help.js +1 -1
  22. package/dist/components/AppFrame/MenuItem.js +6 -6
  23. package/dist/components/AppFrame/Preferences.js +8 -9
  24. package/dist/components/AppFrame/Sidebar.js +5 -5
  25. package/dist/components/AppFrame/Topbar.js +3 -3
  26. package/dist/components/AppFrame/index.js +2 -2
  27. package/dist/components/ApplicationModuleLoader.js +5 -5
  28. package/dist/components/Authenticate.js +2 -2
  29. package/dist/components/Button.js +1 -1
  30. package/dist/components/CategoryList.js +6 -6
  31. package/dist/components/Checkbox.js +5 -5
  32. package/dist/components/ColumnWrapper.js +1 -1
  33. package/dist/components/Culture.js +1 -1
  34. package/dist/components/DevPages.js +1 -1
  35. package/dist/components/DropMenu/Menu.js +2 -2
  36. package/dist/components/DropMenu/index.js +5 -5
  37. package/dist/components/ErrorPlaceholder.js +4 -4
  38. package/dist/components/Form/Combination.js +2 -2
  39. package/dist/components/Form/Field.js +3 -3
  40. package/dist/components/Form/FieldElements.js +4 -4
  41. package/dist/components/Form/FieldList.js +10 -11
  42. package/dist/components/Form/Fieldset.js +1 -1
  43. package/dist/components/Form/Form.js +2 -2
  44. package/dist/components/Form/FormElement.js +1 -1
  45. package/dist/components/Form/InputField.js +10 -10
  46. package/dist/components/Form/Inputs/Button.js +4 -4
  47. package/dist/components/Form/Inputs/Date.js +4 -4
  48. package/dist/components/Form/Inputs/FieldButtons.js +2 -2
  49. package/dist/components/Form/Inputs/Number.js +4 -4
  50. package/dist/components/Form/Inputs/ReadOnly.js +1 -1
  51. package/dist/components/Form/Inputs/SmallButton.js +4 -4
  52. package/dist/components/Form/Inputs/Text.js +4 -5
  53. package/dist/components/Form/Inputs/Time.js +4 -4
  54. package/dist/components/Form/Inputs/Toggles.js +4 -4
  55. package/dist/components/Form/Inputs/Translation.js +12 -12
  56. package/dist/components/Form/Inputs/index.js +1 -1
  57. package/dist/components/Form/index.js +2 -2
  58. package/dist/components/I18n.js +2 -2
  59. package/dist/components/Icon.js +3 -3
  60. package/dist/components/IconButton.js +3 -3
  61. package/dist/components/Input.js +5 -5
  62. package/dist/components/InternetExplorerWarningMessage.js +1 -1
  63. package/dist/components/List/DataCell.js +2 -2
  64. package/dist/components/List/HeadCell.js +2 -2
  65. package/dist/components/List/HeadRow.js +1 -1
  66. package/dist/components/List/List.js +5 -5
  67. package/dist/components/List/Row.js +2 -2
  68. package/dist/components/List/enhanceColumnDefs.js +3 -3
  69. package/dist/components/List/index.js +2 -2
  70. package/dist/components/Loader.js +6 -6
  71. package/dist/components/LoadingIcon.js +2 -2
  72. package/dist/components/MaterialUI/DataDisplay/Badge.js +4 -4
  73. package/dist/components/MaterialUI/DataDisplay/Chip.js +2 -2
  74. package/dist/components/MaterialUI/DataDisplay/CollapsableList.js +6 -6
  75. package/dist/components/MaterialUI/DataDisplay/Divider.js +2 -2
  76. package/dist/components/MaterialUI/DataDisplay/Icon.js +4 -4
  77. package/dist/components/MaterialUI/DataDisplay/List.js +1 -1
  78. package/dist/components/MaterialUI/DataDisplay/Modal.js +5 -5
  79. package/dist/components/MaterialUI/DataDisplay/Notification.js +9 -9
  80. package/dist/components/MaterialUI/DataDisplay/NotificationProps.js +7 -7
  81. package/dist/components/MaterialUI/DataDisplay/PopperedElements/PopperedIcon.js +2 -2
  82. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ActionModal.js +1 -1
  83. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Address.js +2 -2
  84. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ConfirmationModal.js +1 -1
  85. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/DiscountedPrice.js +1 -1
  86. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.js +1 -1
  87. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +24 -14
  88. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.js +4 -4
  89. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +1 -1
  90. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/SectionTitle.js +1 -1
  91. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +25 -11
  92. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +1 -1
  93. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +10 -10
  94. package/dist/components/MaterialUI/DataDisplay/SelectionList.js +17 -25
  95. package/dist/components/MaterialUI/DataDisplay/Table.js +9 -9
  96. package/dist/components/MaterialUI/DataDisplay/TableHeaderCell.js +1 -1
  97. package/dist/components/MaterialUI/DataDisplay/TableProps.js +7 -7
  98. package/dist/components/MaterialUI/DataDisplay/Timeline.js +1 -1
  99. package/dist/components/MaterialUI/DataDisplay/TimelineItem.js +1 -1
  100. package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +7 -7
  101. package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedIcon.js +4 -4
  102. package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedTypography.js +2 -2
  103. package/dist/components/MaterialUI/DataDisplay/TransferList.js +10 -10
  104. package/dist/components/MaterialUI/DataDisplay/chipProps.js +7 -7
  105. package/dist/components/MaterialUI/DataDisplay/collapsableListProps.js +7 -7
  106. package/dist/components/MaterialUI/DataDisplay/dividerProps.js +7 -7
  107. package/dist/components/MaterialUI/DataDisplay/index.js +1 -1
  108. package/dist/components/MaterialUI/DataDisplay/modalProps.js +7 -7
  109. package/dist/components/MaterialUI/DataDisplay/tableHelpers.js +9 -5
  110. package/dist/components/MaterialUI/DataDisplay/useTableSelection.js +7 -7
  111. package/dist/components/MaterialUI/Feedback/NotificationContext.js +6 -6
  112. package/dist/components/MaterialUI/Feedback/loadingScreen.js +6 -6
  113. package/dist/components/MaterialUI/Inputs/Autocomplete.js +6 -6
  114. package/dist/components/MaterialUI/Inputs/AutocompleteProps.js +7 -7
  115. package/dist/components/MaterialUI/Inputs/Checkbox.js +5 -5
  116. package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +5 -5
  117. package/dist/components/MaterialUI/Inputs/CheckboxGroupProps.js +7 -7
  118. package/dist/components/MaterialUI/Inputs/CheckboxProps.js +7 -7
  119. package/dist/components/MaterialUI/Inputs/DatePicker.js +16 -17
  120. package/dist/components/MaterialUI/Inputs/InputBase.js +15 -12
  121. package/dist/components/MaterialUI/Inputs/InputBaseProps.js +7 -7
  122. package/dist/components/MaterialUI/Inputs/LookupSelect.js +3 -3
  123. package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +2 -2
  124. package/dist/components/MaterialUI/Inputs/PredefinedElements/TitledSelect.js +1 -1
  125. package/dist/components/MaterialUI/Inputs/Radio.js +2 -2
  126. package/dist/components/MaterialUI/Inputs/RadioProps.js +7 -7
  127. package/dist/components/MaterialUI/Inputs/Select.js +24 -11
  128. package/dist/components/MaterialUI/Inputs/SelectProps.js +9 -8
  129. package/dist/components/MaterialUI/Inputs/StandaloneRadio.js +5 -5
  130. package/dist/components/MaterialUI/Inputs/Switch.js +33 -21
  131. package/dist/components/MaterialUI/Inputs/SwitchProps.js +7 -7
  132. package/dist/components/MaterialUI/Inputs/TimePicker.js +7 -7
  133. package/dist/components/MaterialUI/Inputs/createInput.js +6 -6
  134. package/dist/components/MaterialUI/Inputs/index.js +1 -1
  135. package/dist/components/MaterialUI/Inputs/standaloneRadioProps.js +7 -7
  136. package/dist/components/MaterialUI/Navigation/DropDownMenu.js +6 -6
  137. package/dist/components/MaterialUI/Navigation/DropDownMenuProps.js +7 -7
  138. package/dist/components/MaterialUI/Navigation/ExternalLink.js +1 -1
  139. package/dist/components/MaterialUI/Navigation/PredefinedElements/ActionMenu.js +1 -1
  140. package/dist/components/MaterialUI/Navigation/TabBar.js +60 -38
  141. package/dist/components/MaterialUI/Navigation/TabLabel.js +5 -5
  142. package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -1
  143. package/dist/components/MaterialUI/ScopeSelector/ScopeTreeView.js +5 -5
  144. package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +13 -8
  145. package/dist/components/MaterialUI/Surfaces/ExpansionPanel.js +5 -5
  146. package/dist/components/MaterialUI/Surfaces/Paper.js +2 -2
  147. package/dist/components/MaterialUI/Surfaces/PredefinedElements/TitledPaper.js +1 -1
  148. package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +5 -5
  149. package/dist/components/MaterialUI/Surfaces/expansionPanelProps.js +8 -8
  150. package/dist/components/MaterialUI/Surfaces/paperProps.js +7 -7
  151. package/dist/components/MaterialUI/componentProps.js +3 -3
  152. package/dist/components/MaterialUI/hocs/withDeferredPopper.js +10 -16
  153. package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +10 -9
  154. package/dist/components/MaterialUI/muiThemes.js +3 -3
  155. package/dist/components/MaterialUI/textProps.js +7 -7
  156. package/dist/components/Modal/Background.js +1 -1
  157. package/dist/components/Modal/Dialog.js +2 -2
  158. package/dist/components/Modal/Wrapper.js +2 -2
  159. package/dist/components/Modal/index.js +6 -6
  160. package/dist/components/Modules.js +9 -9
  161. package/dist/components/MultiSelector.js +9 -9
  162. package/dist/components/Navigation/Bar.js +9 -9
  163. package/dist/components/Navigation/Tab.js +8 -8
  164. package/dist/components/Navigation/index.js +2 -1
  165. package/dist/components/Navigation/useNavigationState.js +9 -9
  166. package/dist/components/Placeholder.js +5 -5
  167. package/dist/components/Provision.js +1 -1
  168. package/dist/components/Routing/FullPage.js +1 -1
  169. package/dist/components/Routing/Page.js +7 -7
  170. package/dist/components/Routing/Segment.js +2 -2
  171. package/dist/components/Routing/SegmentPage.js +11 -11
  172. package/dist/components/Routing/SubPage.js +5 -5
  173. package/dist/components/Routing/withWaypointing.js +5 -5
  174. package/dist/components/Scope/ScopeModificationConfirmationDialog.js +1 -1
  175. package/dist/components/Scope/ScopeNode.js +6 -6
  176. package/dist/components/Scope/Selector.js +1 -1
  177. package/dist/components/Scope/index.js +9 -9
  178. package/dist/components/Scope/useScopeConfirmationModalState.js +10 -10
  179. package/dist/components/Scope/useScopeSelect.js +1 -1
  180. package/dist/components/ScopeExtendedConfigurationLoader.js +5 -5
  181. package/dist/components/Selector.js +9 -9
  182. package/dist/components/Sidepanel.js +2 -2
  183. package/dist/components/Spritesheet.js +1 -1
  184. package/dist/components/Switch.js +5 -5
  185. package/dist/components/TaskDetailsModal.js +2 -2
  186. package/dist/components/Text.js +6 -6
  187. package/dist/components/ToastList.js +9 -6
  188. package/dist/components/Toolbar.js +5 -5
  189. package/dist/components/Tooltip.js +1 -1
  190. package/dist/components/Treeview/Branch.js +1 -1
  191. package/dist/components/Treeview/Label.js +2 -2
  192. package/dist/components/Treeview/Leaf.js +1 -1
  193. package/dist/components/Treeview/Node.js +7 -7
  194. package/dist/components/Treeview/index.js +11 -11
  195. package/dist/constants.js +7 -1
  196. package/dist/getThemeOverrides.js +3 -3
  197. package/dist/hocs/withAuthentication.js +2 -2
  198. package/dist/hocs/withClickOutside.js +4 -4
  199. package/dist/hocs/withErrorBoundary.js +7 -7
  200. package/dist/hocs/withId.js +4 -4
  201. package/dist/hocs/withNavigationLink.js +5 -5
  202. package/dist/hocs/withScopeData.js +5 -5
  203. package/dist/hocs/withScrollBox.js +4 -4
  204. package/dist/hocs/withToggle.js +8 -8
  205. package/dist/hocs/withUpdateHandler.js +3 -3
  206. package/dist/hocs/withViewState.js +5 -5
  207. package/dist/hooks/useEditState.js +3 -3
  208. package/dist/hooks/useEntityLoader.js +8 -8
  209. package/dist/hooks/useFullEntityEditState.js +8 -8
  210. package/dist/hooks/useInfiniteScroll.js +4 -4
  211. package/dist/hooks/useLabelMessage.js +4 -4
  212. package/dist/hooks/useMultipleFieldEditState.js +3 -3
  213. package/dist/hooks/useNotificationRequestState.js +4 -4
  214. package/dist/hooks/useRequestState.js +1 -1
  215. package/dist/hooks/useScopeGuardLoader.js +1 -1
  216. package/dist/hooks/useSelectorAndUnwrap.js +1 -1
  217. package/dist/hooks/useToggle.js +4 -4
  218. package/dist/reducers/applications.js +1 -1
  219. package/dist/reducers/authentication.js +5 -5
  220. package/dist/reducers/countries.js +1 -1
  221. package/dist/reducers/globalErrorMessages.js +1 -1
  222. package/dist/reducers/localeFactory.js +1 -1
  223. package/dist/reducers/metadata.js +18 -10
  224. package/dist/reducers/modules.js +1 -1
  225. package/dist/reducers/navigation.js +1 -1
  226. package/dist/reducers/request.js +1 -1
  227. package/dist/reducers/requestStates.js +1 -1
  228. package/dist/reducers/scopeRouteState.js +1 -1
  229. package/dist/reducers/scopes.js +1 -1
  230. package/dist/reducers/scopesExtendedConfiguration.js +1 -1
  231. package/dist/reducers/settings.js +1 -1
  232. package/dist/reducers/tasks.js +1 -1
  233. package/dist/reducers/timezones.js +1 -1
  234. package/dist/reducers/toasts.js +1 -1
  235. package/dist/reducers/versionInfo.js +1 -1
  236. package/dist/reducers/view.js +1 -1
  237. package/dist/selectors/locale.js +1 -1
  238. package/dist/selectors/metadata.js +4 -4
  239. package/dist/selectors/modules.js +3 -3
  240. package/dist/selectors/navigation.js +1 -1
  241. package/dist/selectors/route.js +1 -1
  242. package/dist/selectors/scope.js +1 -1
  243. package/dist/selectors/tasks.js +1 -1
  244. package/dist/utils/buildUrl.js +19 -5
  245. package/dist/utils/filterHelper.js +4 -2
  246. package/dist/utils/flatten.js +7 -7
  247. package/dist/utils/index.js +1 -1
  248. package/dist/utils/inputHelper.js +71 -0
  249. package/dist/utils/logPass.js +1 -1
  250. package/dist/utils/memoize.js +1 -1
  251. package/dist/utils/modelValidationHelper.js +3 -3
  252. package/dist/utils/normalizeForSearch.js +4 -1
  253. package/dist/utils/propertyBagHelper.js +4 -4
  254. package/dist/utils/propertyHelper.js +6 -6
  255. package/dist/utils/propertyValidator.js +1 -1
  256. package/dist/utils/setTranslation.js +3 -3
  257. package/dist/utils/setTranslationWithFallback.js +3 -3
  258. package/dist/utils/stripKey.js +4 -4
  259. package/dist/utils/styledPropFuncs.js +1 -1
  260. package/dist/utils/testUtils.js +8 -5
  261. package/dist/utils/timezoneHelper.js +6 -6
  262. package/dist/utils/unwrapImmutable.js +1 -1
  263. package/dist/utils/urlHelper.js +3 -3
  264. package/dist/whyDidYouRerender.js +1 -1
  265. package/package.json +2 -5
  266. package/src/components/AppFrame/About.js +4 -3
  267. package/src/components/AppFrame/About.test.js +61 -0
  268. package/src/components/AppFrame/ConnectedToastList.test.js +3 -1
  269. package/src/components/DropMenu/DropMenu.test.js +2 -0
  270. package/src/components/Form/InputField.js +1 -1
  271. package/src/components/Form/InputField.test.js +1 -1
  272. package/src/components/MaterialUI/DataDisplay/Badge.js +1 -1
  273. package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +29 -8
  274. package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.test.js +18 -6
  275. package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +27 -6
  276. package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.test.js +202 -0
  277. package/src/components/MaterialUI/DataDisplay/SelectionList.js +6 -20
  278. package/src/components/MaterialUI/DataDisplay/SelectionList.test.js +0 -6
  279. package/src/components/MaterialUI/DataDisplay/tableHelpers.js +14 -4
  280. package/src/components/MaterialUI/Feedback/loadingScreen.test.js +1 -0
  281. package/src/components/MaterialUI/Feedback/useNotification.test.js +1 -0
  282. package/src/components/MaterialUI/Inputs/DatePicker.js +16 -4
  283. package/src/components/MaterialUI/Inputs/DatePicker.test.js +35 -1
  284. package/src/components/MaterialUI/Inputs/InputBase.js +2 -0
  285. package/src/components/MaterialUI/Inputs/InputBase.test.js +49 -0
  286. package/src/components/MaterialUI/Inputs/Select.js +13 -1
  287. package/src/components/MaterialUI/Inputs/Select.test.js +37 -0
  288. package/src/components/MaterialUI/Inputs/SelectProps.js +1 -0
  289. package/src/components/MaterialUI/Inputs/Switch.js +28 -6
  290. package/src/components/MaterialUI/Inputs/Switch.test.js +39 -0
  291. package/src/components/MaterialUI/Navigation/TabBar.js +55 -34
  292. package/src/components/MaterialUI/ScopeSelector/TreeItem.js +6 -2
  293. package/src/components/MaterialUI/ScopeSelector/TreeItem.test.js +39 -0
  294. package/src/components/MaterialUI/hocs/withDeferredPopper.js +1 -4
  295. package/src/components/MaterialUI/hocs/withDeferredPopper.test.js +2 -0
  296. package/src/components/Modal/Modal.test.js +3 -1
  297. package/src/components/Modal/Wrapper.test.js +3 -1
  298. package/src/components/Routing/SegmentPage.js +2 -1
  299. package/src/components/Scope/Scope.test.js +3 -1
  300. package/src/components/Sidepanel.test.js +3 -1
  301. package/src/components/ToastList.js +2 -2
  302. package/src/constants.js +5 -0
  303. package/src/hocs/withErrorBoundary.test.js +4 -3
  304. package/src/hooks/useEditState.test.js +2 -0
  305. package/src/hooks/useLabelMessage.test.js +2 -0
  306. package/src/reducers/metadata.js +12 -17
  307. package/src/reducers/metadata.test.js +318 -156
  308. package/src/utils/buildUrl.js +15 -0
  309. package/src/utils/buildUrl.test.js +27 -1
  310. package/src/utils/filterHelper.js +4 -2
  311. package/src/utils/filterHelper.test.js +6 -6
  312. package/src/utils/inputHelper.js +22 -0
  313. package/src/utils/inputHelper.test.js +47 -0
  314. package/src/utils/normalizeForSearch.js +2 -0
  315. package/src/utils/propertyBagHelper.js +6 -3
  316. package/src/utils/propertyHelper.js +6 -6
  317. package/src/utils/testUtils.js +25 -22
  318. 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: props => (props.readOnly ? "default" : "inherit"),
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: props => (props.readOnly ? "none" : "inherit"),
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
- left: props => props.readOnly && theme.spacing(0.9),
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, readOnly });
99
- const switchClasses = { ...classes, ...className };
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 = (_, value) => {
126
- if (typeof value === "number" && value >= 0 && value < pages.length) {
127
- const href = pages[value].href;
128
- history.push(href);
129
- } else {
130
- history.push(module.href);
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 = oldIndex => {
146
- const newIndex = oldIndex + 1 >= tabLabels.length ? oldIndex - 1 : oldIndex + 1;
147
- return newIndex;
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
- let entityIdKey = Object.keys(params).find(p => p.toLowerCase().endsWith("id"));
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, closingActions]);
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
 
@@ -22,7 +22,9 @@ describe("Modal", () => {
22
22
  afterEach(() => {
23
23
  try {
24
24
  ReactDOM.unmountComponentAtNode(appRoot);
25
- } catch (_) {}
25
+ } catch {
26
+ // don't do anything
27
+ }
26
28
  document.body.removeChild(appRoot);
27
29
  document.body.removeChild(modalRoot);
28
30
  });
@@ -35,7 +35,9 @@ describe("Wrapper", () => {
35
35
  afterEach(() => {
36
36
  try {
37
37
  ReactDOM.unmountComponentAtNode(appRoot);
38
- } catch (_) {}
38
+ } catch {
39
+ // don't do anything
40
+ }
39
41
  document.body.removeChild(appRoot);
40
42
  document.body.removeChild(modalRoot);
41
43
  });
@@ -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: !!!View });
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
  });
@@ -25,7 +25,9 @@ describe("Sidepanel", () => {
25
25
  afterEach(() => {
26
26
  try {
27
27
  ReactDOM.unmountComponentAtNode(appRoot);
28
- } catch (_) {}
28
+ } catch {
29
+ // don't do anything
30
+ }
29
31
  document.body.removeChild(appRoot);
30
32
  document.body.removeChild(modalRoot);
31
33
  });
@@ -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
@@ -1,5 +1,10 @@
1
1
  export const infoBar = "infoBar";
2
2
 
3
+ export const applications = {
4
+ oms: "oms",
5
+ pim: "pim",
6
+ };
7
+
3
8
  export const scopeTypes = {
4
9
  global: "Global",
5
10
  virtual: "Virtual",
@@ -28,9 +28,10 @@ describe("withErrorBoundary", () => {
28
28
  { args: ["Caught an error: Fail, at boundary Failed"] },
29
29
  {
30
30
  args: [
31
- "\n in FailBall (created by ErrorBoundary)\n" +
32
- " in ErrorBoundary (created by BoundedFailBall)\n" +
33
- " in BoundedFailBall",
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
  ]);
@@ -1,3 +1,5 @@
1
+ /* eslint-disable react/no-unknown-property */
2
+
1
3
  import React from "react";
2
4
  import { useEditState, useDynamicEditState } from "./useEditState";
3
5
  import { TestWrapper } from "./../utils/testUtils";
@@ -1,3 +1,5 @@
1
+ /* eslint react/no-unknown-property: off */
2
+
1
3
  import React from "react";
2
4
  import { Provider } from "react-redux";
3
5
  import { IntlProvider } from "react-intl";
@@ -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 state.setIn(
160
- ["lookups", ORDER_MODULE_NAME, "index", action.payload.lookupName],
161
- Immutable.fromJS(action.payload),
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 = state.setIn(
166
- ["lookups", ORDER_MODULE_NAME, "index", action.payload.lookupName],
167
- Immutable.fromJS(action.payload),
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 state.setIn(
176
- ["lookups", CUSTOMER_MODULE_NAME, "index", action.payload.lookupName],
177
- Immutable.fromJS(action.payload),
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 = state.setIn(
182
- ["lookups", CUSTOMER_MODULE_NAME, "index", action.payload.lookupName],
183
- Immutable.fromJS(action.payload),
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