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
@@ -133,6 +133,208 @@ describe("StepperModal", () => {
133
133
  expect(component, "when mounted", "to satisfy", expected);
134
134
  });
135
135
 
136
+ it("Renders StepperModal correctly with custom actions", () => {
137
+ const open = true;
138
+ const title = "title";
139
+ const backdropClickCallback = jest.fn();
140
+ const okCallback = jest.fn();
141
+ const cancelCallback = jest.fn();
142
+ const modalProps = new ModalProps();
143
+ const actions = [
144
+ {
145
+ value: "first value",
146
+ label: "first action",
147
+ Handler: () => {},
148
+ },
149
+ {
150
+ value: "second value",
151
+ label: "second action",
152
+ Handler: () => {},
153
+ },
154
+ ];
155
+ const steps = [{ title: "step1", content: <div>content</div>, actions }, { title: "step2" }];
156
+
157
+ const titleComponent = (
158
+ <div>
159
+ <div>{title}</div>
160
+ <div>step1</div>
161
+ <div>step2</div>
162
+ </div>
163
+ );
164
+ const messageComponent = <div>{steps[0].content}</div>;
165
+
166
+ modalProps.set(ModalProps.propNames.title, titleComponent);
167
+ modalProps.set(ModalProps.propNames.open, open);
168
+ modalProps.set(ModalProps.propNames.backdropClickCallback, backdropClickCallback);
169
+ modalProps.set(ModalProps.propNames.type, "wide");
170
+
171
+ const actionPanel = (
172
+ <div>
173
+ <div></div>
174
+ <div>
175
+ <Button variant="outlined" disabled={false} onClick={() => cancelCallback()}>
176
+ {sharedMessages.cancel.defaultMessage}
177
+ </Button>
178
+ <Button variant="contained" color="primary" disabled={false} onClick={() => {}} disableElevation>
179
+ first action
180
+ </Button>
181
+ <Button variant="contained" color="primary" disabled={false} onClick={() => {}} disableElevation>
182
+ second action
183
+ </Button>
184
+ </div>
185
+ </div>
186
+ );
187
+
188
+ modalProps.set(ModalProps.propNames.actionPanel, actionPanel);
189
+
190
+ const component = (
191
+ <IntlProvider locale="en-US" messages={messages}>
192
+ <StepperModal
193
+ steps={steps}
194
+ title={title}
195
+ open={open}
196
+ confirmCallback={okCallback}
197
+ closeCallback={cancelCallback}
198
+ />
199
+ </IntlProvider>
200
+ );
201
+
202
+ const expected = (
203
+ <IntlProvider locale="en-US" messages={messages}>
204
+ <Modal message={messageComponent} modalProps={modalProps} />
205
+ </IntlProvider>
206
+ );
207
+
208
+ expect(component, "when mounted", "to satisfy", expected);
209
+ });
210
+
211
+ it("Renders StepperModal correctly with disabled custom actions", () => {
212
+ const open = true;
213
+ const title = "title";
214
+ const backdropClickCallback = jest.fn();
215
+ const okCallback = jest.fn();
216
+ const cancelCallback = jest.fn();
217
+ const modalProps = new ModalProps();
218
+ const actions = [
219
+ {
220
+ value: "first value",
221
+ label: "first action",
222
+ Handler: () => {},
223
+ },
224
+ {
225
+ value: "second value",
226
+ label: "second action",
227
+ Handler: () => {},
228
+ },
229
+ ];
230
+ const steps = [
231
+ { title: "step1", nextDisabled: () => true, content: <div>content</div>, actions },
232
+ { title: "step2" },
233
+ ];
234
+
235
+ const titleComponent = (
236
+ <div>
237
+ <div>{title}</div>
238
+ <div>step1</div>
239
+ <div>step2</div>
240
+ </div>
241
+ );
242
+ const messageComponent = <div>{steps[0].content}</div>;
243
+
244
+ modalProps.set(ModalProps.propNames.title, titleComponent);
245
+ modalProps.set(ModalProps.propNames.open, open);
246
+ modalProps.set(ModalProps.propNames.backdropClickCallback, backdropClickCallback);
247
+ modalProps.set(ModalProps.propNames.type, "wide");
248
+
249
+ const actionPanel = (
250
+ <div>
251
+ <div></div>
252
+ <div>
253
+ <Button variant="outlined" disabled={false} onClick={() => cancelCallback()}>
254
+ {sharedMessages.cancel.defaultMessage}
255
+ </Button>
256
+ <Button variant="contained" color="primary" disabled={true} onClick={() => {}} disableElevation>
257
+ first action
258
+ </Button>
259
+ <Button variant="contained" color="primary" disabled={true} onClick={() => {}} disableElevation>
260
+ second action
261
+ </Button>
262
+ </div>
263
+ </div>
264
+ );
265
+
266
+ modalProps.set(ModalProps.propNames.actionPanel, actionPanel);
267
+
268
+ const component = (
269
+ <IntlProvider locale="en-US" messages={messages}>
270
+ <StepperModal
271
+ steps={steps}
272
+ title={title}
273
+ open={open}
274
+ confirmCallback={okCallback}
275
+ closeCallback={cancelCallback}
276
+ />
277
+ </IntlProvider>
278
+ );
279
+
280
+ const expected = (
281
+ <IntlProvider locale="en-US" messages={messages}>
282
+ <Modal message={messageComponent} modalProps={modalProps} />
283
+ </IntlProvider>
284
+ );
285
+
286
+ expect(component, "when mounted", "to satisfy", expected);
287
+ });
288
+
289
+ it("Renders StepperModal correctly when custom action is clicked", () => {
290
+ const open = true;
291
+ const actions = [
292
+ {
293
+ value: "first value",
294
+ label: "first action",
295
+ handler: jest.fn(),
296
+ },
297
+ {
298
+ value: "second value",
299
+ label: "second action",
300
+ handler: jest.fn(),
301
+ },
302
+ ];
303
+
304
+ const okCallback = sinon.spy();
305
+ const cancelCallback = sinon.spy();
306
+ const steps = [
307
+ { title: "step1", content: "content", actions },
308
+ { title: "step2", content: "content2" },
309
+ ];
310
+
311
+ const component = (
312
+ <IntlProvider locale="en-US" messages={messages}>
313
+ <StepperModal open={open} steps={steps} closeCallback={cancelCallback} confirmCallback={okCallback} />
314
+ </IntlProvider>
315
+ );
316
+
317
+ const mountedComponent = mount(component);
318
+
319
+ const firstAction = mountedComponent.find(Button).at(1);
320
+ firstAction.invoke("onClick")();
321
+
322
+ expect(mountedComponent.containsMatchingElement(steps[1].content), "to be truthy");
323
+
324
+ const back = mountedComponent.find(Button).at(0);
325
+ back.invoke("onClick")();
326
+
327
+ expect(mountedComponent.containsMatchingElement(steps[0].content), "to be truthy");
328
+
329
+ const secondAction = mountedComponent.find(Button).at(2);
330
+ secondAction.invoke("onClick")();
331
+
332
+ const okButton = mountedComponent.find(Button).at(2);
333
+ okButton.invoke("onClick")();
334
+
335
+ expect(okCallback, "was called");
336
+ });
337
+
136
338
  it("Render closed modal", () => {
137
339
  const open = false;
138
340
 
@@ -2,8 +2,6 @@ import React, { useState, useEffect } from "react";
2
2
  import { makeStyles } from "@material-ui/core/styles";
3
3
  import Grid from "@material-ui/core/Grid";
4
4
  import { ScrollableCustomList } from "./TransferList";
5
- import Divider from "./Divider";
6
- import DividerProps from "./dividerProps";
7
5
 
8
6
  const useStyles = makeStyles(theme => ({
9
7
  title: {
@@ -14,6 +12,10 @@ const useStyles = makeStyles(theme => ({
14
12
  listHeight: {
15
13
  height: props => props.height && theme.spacing(props.height),
16
14
  },
15
+ listHeightWithBorder: {
16
+ height: props => props.height && theme.spacing(props.height),
17
+ borderRight: `1px solid ${theme.palette.grey.borders}`,
18
+ },
17
19
  paper: {
18
20
  flexGrow: 1,
19
21
  height: "1px", // forces the container to takes 100%
@@ -32,9 +34,6 @@ const useStyles = makeStyles(theme => ({
32
34
  borderRadius: theme.spacing(1.5),
33
35
  },
34
36
  },
35
- divider: {
36
- margin: "auto",
37
- },
38
37
  paperLeft: {
39
38
  border: `1px solid ${theme.palette.grey.borders}`,
40
39
  },
@@ -45,6 +44,7 @@ const useStyles = makeStyles(theme => ({
45
44
  display: "flex",
46
45
  flexDirection: "column",
47
46
  height: "100%",
47
+ boxSizing: "border-box",
48
48
  },
49
49
  }));
50
50
 
@@ -98,16 +98,10 @@ const SelectionList = ({
98
98
  };
99
99
 
100
100
  const showDivider = infoPanel && divider;
101
- const dividerProps = new DividerProps();
102
- dividerProps.set(DividerProps.propNames.orientation, "vertical");
103
- dividerProps.set(DividerProps.propNames.light, true);
104
- dividerProps.setStyle(DividerProps.ruleNames.vertical, classes.divider);
105
101
 
106
102
  infoPanelXs = infoPanelXs ?? defaultInfoPanelXs;
107
103
  infoPanel = infoPanel ?? defaultPanel;
108
104
 
109
- const dividerDiff = showDivider ? 1 : 0;
110
-
111
105
  const listComponent = (
112
106
  <div className={classes.listContainer}>
113
107
  <div className={classes.title}>{listData.title}</div>
@@ -129,23 +123,15 @@ const SelectionList = ({
129
123
  </div>
130
124
  );
131
125
 
132
- const dividerComponent = showDivider && (
133
- <Grid item>
134
- <Divider dividerProps={dividerProps} />
135
- </Grid>
136
- );
137
-
138
126
  return (
139
127
  <Grid container spacing={2}>
140
- <Grid item xs={12 - infoPanelXs - dividerDiff} className={classes.listHeight}>
128
+ <Grid item xs={12 - infoPanelXs} className={showDivider ? classes.listHeightWithBorder : classes.listHeight}>
141
129
  {listComponent}
142
130
  </Grid>
143
- {dividerComponent}
144
131
  <Grid item xs={infoPanelXs}>
145
132
  {infoPanel}
146
133
  </Grid>
147
134
  </Grid>
148
135
  );
149
136
  };
150
-
151
137
  export default SelectionList;
@@ -95,9 +95,6 @@ describe("SelectionList", () => {
95
95
  <ScrollableCustomList checked={[]} items={list} classes={{}} />
96
96
  </div>
97
97
  </Grid>
98
- <Grid>
99
- <hr />
100
- </Grid>
101
98
  <Grid>
102
99
  <div>Test</div>
103
100
  </Grid>
@@ -129,9 +126,6 @@ describe("SelectionList", () => {
129
126
  <div>{actionPanel}</div>
130
127
  </div>
131
128
  </Grid>
132
- <Grid>
133
- <hr />
134
- </Grid>
135
129
  <Grid>{infoPanel}</Grid>
136
130
  </Grid>
137
131
  );
@@ -66,7 +66,15 @@ const renderByType = (e, def, rowId, readOnly, transformedValue, index) => {
66
66
  );
67
67
  checkboxProps.set(CheckboxProps.propNames.metadata, { id: rowId, name: def.fieldName });
68
68
 
69
- return [<Checkbox id={"select_" + transformedValue} data-row-id={rowId} checkboxProps={checkboxProps} />, null];
69
+ return [
70
+ <Checkbox
71
+ key={def.type + "_" + rowId}
72
+ id={"select_" + transformedValue}
73
+ data-row-id={rowId}
74
+ checkboxProps={checkboxProps}
75
+ />,
76
+ null,
77
+ ];
70
78
 
71
79
  case "switch":
72
80
  const switchProps = new SwitchProps();
@@ -85,7 +93,9 @@ const renderByType = (e, def, rowId, readOnly, transformedValue, index) => {
85
93
  switchProps.set(SwitchProps.propNames.className, def.switch?.className);
86
94
  switchProps.set(SwitchProps.propNames.metadata, { id: rowId, name: def.fieldName });
87
95
 
88
- return transformedValue != null ? [<Switch data-row-id={rowId} switchProps={switchProps} />] : [null];
96
+ return transformedValue != null
97
+ ? [<Switch key={def.type + "_" + rowId} data-row-id={rowId} switchProps={switchProps} />]
98
+ : [null];
89
99
 
90
100
  case "radio":
91
101
  const selectedValue = def.selectedValue;
@@ -107,7 +117,7 @@ const renderByType = (e, def, rowId, readOnly, transformedValue, index) => {
107
117
  StandaloneRadioProps.propNames.readOnly,
108
118
  def.transform?.readOnly != null ? def.transform.readOnly(e, readOnly, def) : readOnly,
109
119
  );
110
- return [<StandaloneRadio radioProps={radioProps} />];
120
+ return [<StandaloneRadio key={def.type + "_" + rowId} radioProps={radioProps} />];
111
121
 
112
122
  case "textInput":
113
123
  const inputBaseProps = new InputBaseProps();
@@ -124,7 +134,7 @@ const renderByType = (e, def, rowId, readOnly, transformedValue, index) => {
124
134
  );
125
135
  inputBaseProps.set(InputBaseProps.propNames.inputAttributes, def.inputAttributes);
126
136
  inputBaseProps.set(InputBaseProps.propNames.metadata, { id: rowId, name: def.fieldName });
127
- return [<InputBase inputProps={inputBaseProps} />];
137
+ return [<InputBase key={def.type + "_" + rowId} inputProps={inputBaseProps} />];
128
138
  default:
129
139
  return [defaultRendering(e, def, rowId, readOnly, transformedValue)];
130
140
  }
@@ -70,6 +70,7 @@ describe("loadingScreen", () => {
70
70
  const clock = sinon.useFakeTimers();
71
71
  const menuNode = document.createElement("div");
72
72
  document.body.appendChild(menuNode);
73
+ // eslint-disable-next-line react/no-render-return-value
73
74
  const menu = ReactDOM.render(
74
75
  <div>
75
76
  <TestWrapper stylesProvider muiThemeProvider={{ theme }} provider={{ store }}>
@@ -8,6 +8,7 @@ const TestComp = () => {
8
8
  const addNotification = useNotification(snackPack, setSnackPack);
9
9
  return (
10
10
  <div>
11
+ {/* eslint-disable-next-line react/no-unknown-property */}
11
12
  <div id="notification" snacks={snackPack} onClick={(message, type) => addNotification(message, type)} />
12
13
  </div>
13
14
  );
@@ -21,11 +21,11 @@ const useStyles = makeStyles(theme => ({
21
21
  datePickerWrapper: {
22
22
  display: "flex",
23
23
  width: "auto",
24
- padding: props => (props.readOnly ? "0" : theme.spacing(0.3, 0.5)),
25
- border: props => (props.readOnly ? "none" : `1px solid ${theme.palette.grey.borders}`),
24
+ padding: theme.spacing(0.3, 0.5),
25
+ border: `1px solid ${theme.palette.grey.borders}`,
26
26
  borderRadius: theme.shape.borderRadius,
27
27
  alignItems: "center",
28
- backgroundColor: props => (props.readOnly ? "inherit" : theme.palette.background.default),
28
+ backgroundColor: theme.palette.background.default,
29
29
  "&:focus, &:focus-within": {
30
30
  borderRadius: theme.shape.borderRadius,
31
31
  borderColor: theme.palette.focus,
@@ -82,6 +82,11 @@ const useStyles = makeStyles(theme => ({
82
82
  opacity: 0.4,
83
83
  },
84
84
  },
85
+ datePickerWrapperReadOnly: {
86
+ padding: "0",
87
+ border: "none",
88
+ backgroundColor: "inherit",
89
+ },
85
90
  disabled: {
86
91
  border: `1px solid ${theme.palette.grey.light} !important`,
87
92
  backgroundColor: `${theme.palette.grey.light} !important`,
@@ -157,7 +162,14 @@ const WrappedDatePicker = ({
157
162
 
158
163
  return (
159
164
  <div className={classes.container}>
160
- <label className={classNames(classes.datePickerWrapper, disabledCls, error ? classes.errorInput : null)}>
165
+ <label
166
+ className={classNames(
167
+ classes.datePickerWrapper,
168
+ readOnly ? classes.datePickerWrapperReadOnly : null,
169
+ disabledCls,
170
+ error ? classes.errorInput : null,
171
+ )}
172
+ >
161
173
  <div className={classes.datePickerContainer}>
162
174
  <DatePicker
163
175
  {...props}
@@ -3,8 +3,10 @@ import DatePicker, { createFormat } from "./DatePicker";
3
3
  import { mount } from "enzyme";
4
4
  import sinon from "sinon";
5
5
  import Icon from "../DataDisplay/Icon";
6
- import { TestWrapper, createMuiTheme } from "./../../../utils/testUtils";
6
+ import { TestWrapper, createMuiTheme, generateClassName } from "./../../../utils/testUtils";
7
7
  import Immutable from "immutable";
8
+ import { StylesProvider } from "@material-ui/core/styles";
9
+ import { MuiThemeProvider } from "@material-ui/core";
8
10
 
9
11
  describe("DatePicker", () => {
10
12
  let updater, state, store;
@@ -426,6 +428,38 @@ describe("DatePicker", () => {
426
428
  input.at(0).simulate("change", event);
427
429
  });
428
430
 
431
+ it("should have readonly styles when readonly", () => {
432
+ const date = new Date("2020-06-30T00:00:00");
433
+
434
+ const component = (
435
+ <TestWrapper provider={{ store }} intlProvider>
436
+ <StylesProvider generateClassName={generateClassName}>
437
+ <MuiThemeProvider theme={createMuiTheme()}>
438
+ <DatePicker useTime={true} readOnly={true} onChange={updater} value={date} />
439
+ </MuiThemeProvider>
440
+ </StylesProvider>
441
+ </TestWrapper>
442
+ );
443
+ const mountedComponent = mount(component);
444
+ expect(mountedComponent.exists(".makeStyles-datePickerWrapperReadOnly"), "to be true");
445
+ });
446
+
447
+ it("should have updatable styles when updatable", () => {
448
+ const date = new Date("2020-06-30T00:00:00");
449
+
450
+ const component = (
451
+ <TestWrapper provider={{ store }} intlProvider>
452
+ <StylesProvider generateClassName={generateClassName}>
453
+ <MuiThemeProvider theme={createMuiTheme()}>
454
+ <DatePicker useTime={true} readOnly={false} onChange={updater} value={date} />
455
+ </MuiThemeProvider>
456
+ </StylesProvider>
457
+ </TestWrapper>
458
+ );
459
+ const mountedComponent = mount(component);
460
+ expect(mountedComponent.exists(".makeStyles-datePickerWrapperReadOnly"), "to be false");
461
+ });
462
+
429
463
  it("should call onChange prop with useTimeZone", () => {
430
464
  const onChangeMock = jest.fn();
431
465
  const date = new Date("2020-06-30T00:00:00");
@@ -4,6 +4,7 @@ import InputBaseMUI from "@material-ui/core/InputBase";
4
4
  import InputBaseProps, { isInputProps } from "./InputBaseProps";
5
5
  import classNames from "classnames";
6
6
  import { NumericFormat, numericFormatter } from "react-number-format";
7
+ import { trimSpacesAndLeadingZeros } from "../../../utils/inputHelper";
7
8
 
8
9
  export const useStyles = makeStyles(theme => ({
9
10
  container: {
@@ -207,6 +208,7 @@ const InputBase = ({ inputProps }) => {
207
208
  formattingProps.fixedDecimalScale = true;
208
209
  }
209
210
 
211
+ updateValue = trimSpacesAndLeadingZeros(updateValue, numericInputProps?.defaultValue ?? "");
210
212
  updateValue = numericFormatter(updateValue, formattingProps);
211
213
  }
212
214
 
@@ -643,6 +643,55 @@ describe("AdvancedNumericInput", () => {
643
643
  expect(update, "to have calls satisfying", [{ args: ["12.20", metadata] }]);
644
644
  });
645
645
 
646
+ it("OnBlur trims spaces and leading zeros of values", () => {
647
+ const inputProps = new InputBaseProps();
648
+ const aLabel = "aLabel";
649
+ const aValue = "012.2";
650
+ const metadata = {
651
+ test: "value",
652
+ };
653
+
654
+ inputProps.set(InputBaseProps.propNames.update, update);
655
+ inputProps.set(InputBaseProps.propNames.value, aValue);
656
+ inputProps.set(InputBaseProps.propNames.label, aLabel);
657
+ inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
658
+ inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 1 });
659
+ inputProps.set(InputBaseProps.propNames.metadata, metadata);
660
+
661
+ const component = <InputBase inputProps={inputProps} />;
662
+ const mountedComponent = mount(component);
663
+ const input = mountedComponent.find("input");
664
+
665
+ input.simulate("blur", {});
666
+
667
+ // Update is called twice, once from onChangeHandler (from React) and once from onBlurInternal
668
+ expect(update, "to have calls satisfying", [{ args: ["12.2", metadata] }, { args: ["12.2", metadata] }]);
669
+ });
670
+
671
+ it("OnBlur use default value if trim spaces and leading zeroes returns empty ", () => {
672
+ const inputProps = new InputBaseProps();
673
+ const aLabel = "aLabel";
674
+ const aValue = "";
675
+ const metadata = {
676
+ test: "value",
677
+ };
678
+
679
+ inputProps.set(InputBaseProps.propNames.update, update);
680
+ inputProps.set(InputBaseProps.propNames.value, aValue);
681
+ inputProps.set(InputBaseProps.propNames.label, aLabel);
682
+ inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
683
+ inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2, defaultValue: "84" });
684
+ inputProps.set(InputBaseProps.propNames.metadata, metadata);
685
+
686
+ const component = <InputBase inputProps={inputProps} />;
687
+ const mountedComponent = mount(component);
688
+ const input = mountedComponent.find("input");
689
+
690
+ input.simulate("blur", {});
691
+
692
+ expect(update, "to have calls satisfying", [{ args: ["84.00", metadata] }]);
693
+ });
694
+
646
695
  it("Onblur send a formatted string instead of a number", () => {
647
696
  const inputProps = new InputBaseProps();
648
697
  const aLabel = "aLabel";
@@ -145,6 +145,8 @@ export const SelectIconButton = props => {
145
145
  );
146
146
  };
147
147
 
148
+ const selectEmptyValue = "~~#~~";
149
+
148
150
  const Select = ({ options, selectProps, children }) => {
149
151
  if (isSelectProps(selectProps) === false) {
150
152
  throw new TypeError("selectProps property is not of type SelectProps");
@@ -177,6 +179,16 @@ const Select = ({ options, selectProps, children }) => {
177
179
  );
178
180
  } else if (sortType === sortTypeEnum.default) {
179
181
  options.sort((a, b) => (a.sortOrder > b.sortOrder ? 1 : -1));
182
+ } else if (sortType === sortTypeEnum.alphabetical) {
183
+ options.sort((a, b) => {
184
+ if (a.value === selectEmptyValue) {
185
+ return -1;
186
+ }
187
+ if (b.value === selectEmptyValue) {
188
+ return 1;
189
+ }
190
+ return a.label.localeCompare(b.label);
191
+ });
180
192
  }
181
193
 
182
194
  if (showAllValue && showAllLabel) {
@@ -207,7 +219,7 @@ const Select = ({ options, selectProps, children }) => {
207
219
  const appliedClasses = classNames(classes.baseItem, clss);
208
220
  const labelClss = classNames({
209
221
  [classes.label]: true,
210
- [classes.emptyLabel]: option.value === "" || option.value === "~~#~~",
222
+ [classes.emptyLabel]: option.value === "" || option.value === selectEmptyValue,
211
223
  });
212
224
 
213
225
  const disabled = !!option.disabled;
@@ -496,6 +496,43 @@ describe("Select Component", () => {
496
496
  expect(optionsKeys, "to equal", ["#All#", "a", "b", "c"]);
497
497
  });
498
498
 
499
+ it("Sorts select options correctly with alphabetical sorting", () => {
500
+ const emptyValue = "~~#~~";
501
+
502
+ const options = [
503
+ { value: "c", label: "c" },
504
+ { value: "a", label: "a" },
505
+ { value: "b", label: "b" },
506
+ { value: "f", label: "f" },
507
+ { value: emptyValue, label: "empty" },
508
+ { value: "h", label: "h" },
509
+ { value: "g", label: "g" },
510
+ { value: "e", label: "e" },
511
+ { value: "d", label: "[d]" },
512
+ ];
513
+
514
+ const selectProps = new SelectProps();
515
+
516
+ selectProps.set(SelectProps.propNames.sortType, sortTypeEnum.alphabetical);
517
+ selectProps.set(SelectProps.propNames.value, "b");
518
+
519
+ const component = (
520
+ <TestWrapper stylesProvider muiThemeProvider={{ theme }}>
521
+ <Select options={options} selectProps={selectProps} />
522
+ </TestWrapper>
523
+ );
524
+
525
+ const mountedComponent = mount(component);
526
+
527
+ const test = mountedComponent.find(SelectMUI);
528
+
529
+ const mountedOptions = test.props().children;
530
+
531
+ const optionsKeys = mountedOptions.map(option => option.key);
532
+
533
+ expect(optionsKeys, "to equal", [emptyValue, "d", "a", "b", "c", "e", "f", "g", "h"]);
534
+ });
535
+
499
536
  it("Sorts select options correctly with numeric sorting", () => {
500
537
  const options = [
501
538
  { value: "BRC-409 - BRC-PROMENADES", label: "BRC-409 - BRC-PROMENADES", sortOrder: "BRC-409 - BRC-PROMENADES" },
@@ -4,6 +4,7 @@ export const sortTypeEnum = {
4
4
  none: 0,
5
5
  default: 1,
6
6
  numeric: 2,
7
+ alphabetical: 3,
7
8
  };
8
9
 
9
10
  class SelectProps extends ComponentProps {