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,6 +1,6 @@
1
1
  import sinon from "sinon";
2
2
  import { spyOnConsole } from "./testUtils";
3
- import { loadConfig, resetConfig, buildUrl } from "./buildUrl";
3
+ import { loadConfig, resetConfig, buildUrl, buildExternalAppUrl } from "./buildUrl";
4
4
 
5
5
  describe("loadConfig", () => {
6
6
  spyOnConsole();
@@ -72,4 +72,30 @@ describe("loadConfig", () => {
72
72
  ));
73
73
  });
74
74
  });
75
+
76
+ describe("buildExternalAppUrl", () => {
77
+ it("throws an error if called with an unknown app", () => {
78
+ expect(
79
+ () => expect(buildExternalAppUrl, "when called with", ["unknown", "fakeurl"]),
80
+ "to throw",
81
+ "Not implemented app 'unknown'",
82
+ );
83
+ });
84
+
85
+ it("should build an valid relative url with oms", () => {
86
+ expect(buildExternalAppUrl, "called with", ["oms", "fakeurl"], "to equal", "/oms/app/fakeurl");
87
+ });
88
+
89
+ it("should build an valid relative url with pim", () => {
90
+ expect(buildExternalAppUrl, "called with", ["pim", "fakeurl"], "to equal", "/pim/app/fakeurl");
91
+ });
92
+
93
+ it("should not be case sensitive about the app name", () => {
94
+ expect(buildExternalAppUrl, "called with", ["PIM", "fakeurl"], "to equal", "/pim/app/fakeurl");
95
+ });
96
+
97
+ it("should handle delimiter", () => {
98
+ expect(buildExternalAppUrl, "called with", ["pim", "/fakeurl"], "to equal", "/pim/app/fakeurl");
99
+ });
100
+ });
75
101
  });
@@ -1,5 +1,6 @@
1
1
  import { allValue } from "../constants";
2
2
  import { memoize } from "./index";
3
+ import { getNotLocalizedString } from "./localizationHelper";
3
4
 
4
5
  export const getValueWithAll = value => {
5
6
  if (!value) return allValue;
@@ -20,9 +21,10 @@ export const extractDropboxOptionsMemo = (data, config = undefined) => {
20
21
  let options = [];
21
22
  items.forEach(v => {
22
23
  if (!activeKey || v.get(activeKey)) {
24
+ const value = v.get(valueKey);
23
25
  options.push({
24
- value: v.get(valueKey),
25
- label: v.get(labelKey) || (fallbackLabelKey && v.get(fallbackLabelKey)),
26
+ value: value,
27
+ label: v.get(labelKey) || (fallbackLabelKey && v.get(fallbackLabelKey)) || getNotLocalizedString(value),
26
28
  sortOrder: v.get(sortOrderKey),
27
29
  });
28
30
  }
@@ -43,8 +43,8 @@ describe("extractDropboxOptions", () => {
43
43
  const result = extractDropboxOptions(lookup);
44
44
 
45
45
  expect(result, "to equal", [
46
- { value: "value1", label: undefined, sortOrder: 0 },
47
- { value: "value3", label: undefined, sortOrder: 3 },
46
+ { value: "value1", label: "[value1]", sortOrder: 0 },
47
+ { value: "value3", label: "[value3]", sortOrder: 3 },
48
48
  ]);
49
49
  });
50
50
 
@@ -60,8 +60,8 @@ describe("extractDropboxOptions", () => {
60
60
  const result = extractDropboxOptions(lookups);
61
61
 
62
62
  expect(result, "to equal", [
63
- { value: "value4", label: undefined, sortOrder: 0 },
64
- { value: "value6", label: undefined, sortOrder: 3 },
63
+ { value: "value4", label: "[value4]", sortOrder: 0 },
64
+ { value: "value6", label: "[value6]", sortOrder: 3 },
65
65
  ]);
66
66
  });
67
67
 
@@ -77,8 +77,8 @@ describe("extractDropboxOptions", () => {
77
77
  const result = extractDropboxOptions(lookup);
78
78
 
79
79
  expect(result, "to equal", [
80
- { value: "value1", label: undefined, sortOrder: 0 },
81
- { value: "value3", label: undefined, sortOrder: 3 },
80
+ { value: "value1", label: "[value1]", sortOrder: 0 },
81
+ { value: "value3", label: "[value3]", sortOrder: 3 },
82
82
  ]);
83
83
  });
84
84
 
@@ -0,0 +1,22 @@
1
+ export const trimSpacesAndLeadingZeros = (value, fallback = "") => {
2
+ if (!value || isNaN(value)) {
3
+ return fallback;
4
+ }
5
+
6
+ let trimmed = value.trim();
7
+ const isNegative = trimmed[0] === "-";
8
+ if (isNegative) {
9
+ trimmed = trimmed.substring(1, trimmed.length);
10
+ }
11
+
12
+ const withoutLeadingZeros = trimmed.replace(/^0+/, "");
13
+ if (withoutLeadingZeros == "") {
14
+ return "0";
15
+ }
16
+
17
+ const cleanNumber = `${isNegative ? "-" : ""}${withoutLeadingZeros}`;
18
+
19
+ return limitNumericValueLength(cleanNumber);
20
+ };
21
+
22
+ export const limitNumericValueLength = (value, maximum = 9) => value.substring(0, maximum);
@@ -0,0 +1,47 @@
1
+ import { limitNumericValueLength, trimSpacesAndLeadingZeros } from "./inputHelper";
2
+
3
+ describe("Numeric Input Helper", () => {
4
+ it("trimSpacesAndLeadingZeros trims spaces and leading zeros", () => {
5
+ expect(trimSpacesAndLeadingZeros, "when called with", [" 00013 "], "to equal", "13");
6
+ });
7
+
8
+ it("trimSpacesAndLeadingZeros trims spaces and leading zeros returning 0 when 000 value", () => {
9
+ expect(trimSpacesAndLeadingZeros, "when called with", [" 000 ", "def"], "to equal", "0");
10
+ });
11
+
12
+ it("trimSpacesAndLeadingZeros trims spaces and leading zeros returning fallback when empty string value", () => {
13
+ expect(trimSpacesAndLeadingZeros, "when called with", ["", "def"], "to equal", "def");
14
+ });
15
+
16
+ it("trimSpacesAndLeadingZeros trims spaces and leading zeros returning 0 when 0 value", () => {
17
+ expect(trimSpacesAndLeadingZeros, "when called with", [" 0 ", "def"], "to equal", "0");
18
+ });
19
+
20
+ it("trimSpacesAndLeadingZeros should work on floating values", () => {
21
+ expect(trimSpacesAndLeadingZeros, "when called with", ["042.2", "def"], "to equal", "42.2");
22
+ });
23
+
24
+ it("trimSpacesAndLeadingZeros should work on negative values", () => {
25
+ expect(trimSpacesAndLeadingZeros, "when called with", ["-0012.2", "def"], "to equal", "-12.2");
26
+ });
27
+
28
+ it("trimSpacesAndLeadingZeros returns fallback on null value", () => {
29
+ expect(trimSpacesAndLeadingZeros, "when called with", [null, "def"], "to equal", "def");
30
+ });
31
+
32
+ it("trimSpacesAndLeadingZeros returns fallback on undefined value", () => {
33
+ expect(trimSpacesAndLeadingZeros, "when called with", [undefined, "def"], "to equal", "def");
34
+ });
35
+
36
+ it("trimSpacesAndLeadingZeros returns fallback when value is not a number", () => {
37
+ expect(trimSpacesAndLeadingZeros, "when called with", ["hello", "def"], "to equal", "def");
38
+ });
39
+
40
+ it("limitNumericValueLength trims extra characters", () => {
41
+ expect(limitNumericValueLength, "when called with", ["01234567890"], "to equal", "012345678");
42
+ });
43
+
44
+ it("limitNumericValueLength trims extra characters with another maximum", () => {
45
+ expect(limitNumericValueLength, "when called with", ["01234567890", 5], "to equal", "01234");
46
+ });
47
+ });
@@ -6,6 +6,8 @@ if ("".normalize) {
6
6
  .toLowerCase()
7
7
  // Strip accents by normalizing to letters + combining chars, then strip all combining chars.
8
8
  .normalize("NFKD")
9
+ // Note AD20240801: the new eslint config complains on the next line however I have no idea what it is supposed to do so to be safe I'll disable the warning
10
+ // eslint-disable-next-line no-misleading-character-class
9
11
  .replace(/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/g, "");
10
12
  } else {
11
13
  // IE11 does not support string#normalize(). V. sad for IE users.
@@ -149,7 +149,7 @@ export const getPropertyBagFormattedPrimitiveValue = (propertyBagValue, formatMe
149
149
  }
150
150
 
151
151
  if (dataTypesChecker.isBoolean(propertyBagValue[serializationTypeKey])) {
152
- return Boolean(propertyBagValue.value)
152
+ return propertyBagValue.value
153
153
  ? formatMessage(sharedMessages.valueTypeWrapperTrue)
154
154
  : formatMessage(sharedMessages.valueTypeWrapperFalse);
155
155
  }
@@ -182,7 +182,7 @@ export const formatNumber = (value, precision) => Number(value).toFixed(precisio
182
182
 
183
183
  export const fixPropertyBagModifiedModel = (model, ...fields) => {
184
184
  const fixProfileOperations = model => {
185
- if (model.hasOwnProperty("profileOperations")) {
185
+ if (Object.prototype.hasOwnProperty.call(model, "profileOperations")) {
186
186
  let { profilesToAdd, profilesToUpdate } = model.profileOperations;
187
187
  if (profilesToAdd) {
188
188
  const items = Array.isArray(profilesToAdd) ? profilesToAdd : Object.values(profilesToAdd);
@@ -224,7 +224,10 @@ export const fixPropertyBagEmptyValues = propertyBag => {
224
224
  const modifiedFields = Object.keys(propertyBag);
225
225
  modifiedFields.forEach(propertyName => {
226
226
  let property = propertyBag[propertyName];
227
- let propertyValue = property && isObject(property) && property.hasOwnProperty("value") ? property.value : property;
227
+ let propertyValue =
228
+ property && isObject(property) && Object.prototype.hasOwnProperty.call(property, "value")
229
+ ? property.value
230
+ : property;
228
231
  if (propertyValue === "") {
229
232
  propertyBag[propertyName] = null;
230
233
  }
@@ -22,13 +22,13 @@ export function getPropertyOrDefault(obj, property, defaultValue, ignoreCase = f
22
22
  }
23
23
 
24
24
  if (ignoreCase === false && startWith === false) {
25
- return obj.hasOwnProperty(property) ? obj[property] : defaultValue;
25
+ return Object.prototype.hasOwnProperty.call(obj, property) ? obj[property] : defaultValue;
26
26
  }
27
27
 
28
28
  const compareFunction = startWith ? caseInsensitiveStartWithCompare : caseInsensitiveCompare;
29
29
 
30
30
  for (let prop in obj) {
31
- if (obj.hasOwnProperty(prop) && compareFunction(prop, property)) {
31
+ if (Object.prototype.hasOwnProperty.call(obj, prop) && compareFunction(prop, property)) {
32
32
  return obj[prop];
33
33
  }
34
34
  }
@@ -39,12 +39,12 @@ export function getPropertyOrDefault(obj, property, defaultValue, ignoreCase = f
39
39
  export const isObjectContainsPropertyWithValue = (obj, propertyName, value) => {
40
40
  if (obj === null || obj === undefined) return false;
41
41
 
42
- if (obj.hasOwnProperty(propertyName) && obj[propertyName] === value) {
42
+ if (Object.prototype.hasOwnProperty.call(obj, propertyName) && obj[propertyName] === value) {
43
43
  return true;
44
44
  }
45
45
 
46
46
  for (let prop in obj) {
47
- if (obj.hasOwnProperty(prop) && typeof obj[prop] === "object") {
47
+ if (Object.prototype.hasOwnProperty.call(obj, prop) && typeof obj[prop] === "object") {
48
48
  if (isObjectContainsPropertyWithValue(obj[prop], propertyName, value)) return true;
49
49
  }
50
50
  }
@@ -55,12 +55,12 @@ export const isObjectContainsPropertyWithValue = (obj, propertyName, value) => {
55
55
  export const isObjectContainsPropertyWithAnyValue = (obj, propertyName) => {
56
56
  if (!obj) return false;
57
57
 
58
- if (obj.hasOwnProperty(propertyName) && obj[propertyName]) {
58
+ if (Object.prototype.hasOwnProperty.call(obj, propertyName) && obj[propertyName]) {
59
59
  return true;
60
60
  }
61
61
 
62
62
  for (let prop in obj) {
63
- if (obj.hasOwnProperty(prop) && typeof obj[prop] === "object") {
63
+ if (Object.prototype.hasOwnProperty.call(obj, prop) && typeof obj[prop] === "object") {
64
64
  if (isObjectContainsPropertyWithAnyValue(obj[prop], propertyName)) return true;
65
65
  }
66
66
  }
@@ -15,6 +15,7 @@ const sinon = require("sinon");
15
15
  /* istanbul ignore next */
16
16
  export const spyOnConsole = (spyNames = ["log", "warn", "error"]) => {
17
17
  let spiedFuncs;
18
+ // eslint-disable-next-line no-undef
18
19
  beforeEach(() => {
19
20
  spiedFuncs = spyNames.map(funcName => {
20
21
  const func = sinon.spy().named("console." + funcName);
@@ -23,6 +24,7 @@ export const spyOnConsole = (spyNames = ["log", "warn", "error"]) => {
23
24
  return oldFunc;
24
25
  });
25
26
  });
27
+ // eslint-disable-next-line no-undef
26
28
  afterEach(() => {
27
29
  spiedFuncs.forEach((func, index) => {
28
30
  const name = spyNames[index];
@@ -74,34 +76,35 @@ export const PropStruct = React.forwardRef((props, ref) => (
74
76
  value === undefined || value === null
75
77
  ? null
76
78
  : value === "__ignore"
77
- ? [<Ignore key={"dt-" + key} />, <Ignore key={"dd-" + key} />]
78
- : [
79
- <dt key={"dt-" + key}>{`${key}:`}</dt>,
80
- <dd key={"dd-" + key}>
81
- {key === "children" ? (
82
- value
83
- ) : typeof value === "object" ? (
84
- value["$$typeof"] && value["$$typeof"] === Symbol.for("react.element") ? (
85
- "React <" + (value.type.name || value.type) + ">"
79
+ ? [<Ignore key={"dt-" + key} />, <Ignore key={"dd-" + key} />]
80
+ : [
81
+ <dt key={"dt-" + key}>{`${key}:`}</dt>,
82
+ <dd key={"dd-" + key}>
83
+ {key === "children" ? (
84
+ value
85
+ ) : typeof value === "object" ? (
86
+ value["$$typeof"] && value["$$typeof"] === Symbol.for("react.element") ? (
87
+ "React <" + (value.type.name || value.type) + ">"
88
+ ) : (
89
+ <PropStruct {...value} />
90
+ )
91
+ ) : typeof value === "function" ? (
92
+ "Function"
93
+ ) : typeof value === "string" ? (
94
+ `string "${value}"`
95
+ ) : typeof value === "symbol" ? (
96
+ `symbol ${value.toString()}`
86
97
  ) : (
87
- <PropStruct {...value} />
88
- )
89
- ) : typeof value === "function" ? (
90
- "Function"
91
- ) : typeof value === "string" ? (
92
- `string "${value}"`
93
- ) : typeof value === "symbol" ? (
94
- `symbol ${value.toString()}`
95
- ) : (
96
- typeof value + " " + value
97
- )}
98
- </dd>,
99
- ],
98
+ typeof value + " " + value
99
+ )}
100
+ </dd>,
101
+ ],
100
102
  )}
101
103
  </dl>
102
104
  ));
103
105
 
104
106
  export const ignoreConsoleError = func => {
107
+ // eslint-disable-next-line no-undef
105
108
  jest.spyOn(console, "error");
106
109
  console.error.mockImplementation(() => {});
107
110
 
@@ -187,7 +187,7 @@ describe("PropStruct", () => {
187
187
  <dt>num:</dt>
188
188
  <dd>number 1</dd>
189
189
  <dt>str:</dt>
190
- <dd>string "foo"</dd>
190
+ <dd>string &quot;foo&quot;</dd>
191
191
  </dl>,
192
192
  ));
193
193
 
@@ -198,7 +198,7 @@ describe("PropStruct", () => {
198
198
  "to satisfy",
199
199
  <dl id="testProps">
200
200
  <dt>id:</dt>
201
- <dd>string "testProps"</dd>
201
+ <dd>string &quot;testProps&quot;</dd>
202
202
  </dl>,
203
203
  ));
204
204
 
@@ -261,7 +261,7 @@ describe("PropStruct", () => {
261
261
  <div id="tc2" />
262
262
  </dd>
263
263
  <dt>foo:</dt>
264
- <dd>string "bar"</dd>
264
+ <dd>string &quot;bar&quot;</dd>
265
265
  </dl>,
266
266
  ));
267
267
 
@@ -275,7 +275,7 @@ describe("PropStruct", () => {
275
275
  <dd>
276
276
  <dl>
277
277
  <dt>bar:</dt>
278
- <dd>string "false"</dd>
278
+ <dd>string &quot;false&quot;</dd>
279
279
  <dt>foo:</dt>
280
280
  <dd>boolean true</dd>
281
281
  </dl>