orc-shared 5.8.0-dev.8 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/applications.js +5 -5
- package/dist/actions/authentication.js +5 -5
- package/dist/actions/countries.js +5 -5
- package/dist/actions/locale.js +5 -5
- package/dist/actions/makeApiAction.js +7 -7
- package/dist/actions/makeOrcApiAction.js +2 -2
- package/dist/actions/metadata.js +7 -7
- package/dist/actions/navigation.js +2 -2
- package/dist/actions/scopes.js +5 -5
- package/dist/actions/tasks.js +5 -5
- package/dist/actions/timezones.js +5 -5
- package/dist/actions/versionInfo.js +5 -5
- package/dist/buildStore.js +4 -4
- package/dist/components/AppFrame/About.js +9 -9
- package/dist/components/AppFrame/Anchor.js +1 -1
- package/dist/components/AppFrame/AppFrame.js +6 -6
- package/dist/components/AppFrame/ApplicationSelector/ApplicationDialog.js +1 -1
- package/dist/components/AppFrame/ApplicationSelector/Header.js +4 -4
- package/dist/components/AppFrame/ApplicationSelector/index.js +3 -3
- package/dist/components/AppFrame/ConnectedToastList.js +2 -2
- package/dist/components/AppFrame/Help.js +1 -1
- package/dist/components/AppFrame/MenuItem.js +6 -6
- package/dist/components/AppFrame/Preferences.js +7 -7
- package/dist/components/AppFrame/Sidebar.js +5 -5
- package/dist/components/AppFrame/Topbar.js +3 -3
- package/dist/components/AppFrame/index.js +2 -2
- package/dist/components/ApplicationModuleLoader.js +5 -5
- package/dist/components/Authenticate.js +2 -2
- package/dist/components/Button.js +1 -1
- package/dist/components/CategoryList.js +6 -6
- package/dist/components/Checkbox.js +5 -5
- package/dist/components/ColumnWrapper.js +1 -1
- package/dist/components/Culture.js +1 -1
- package/dist/components/DevPages.js +1 -1
- package/dist/components/DropMenu/Menu.js +2 -2
- package/dist/components/DropMenu/index.js +5 -5
- package/dist/components/ErrorPlaceholder.js +4 -4
- package/dist/components/Form/Combination.js +2 -2
- package/dist/components/Form/Field.js +3 -3
- package/dist/components/Form/FieldElements.js +4 -4
- package/dist/components/Form/FieldList.js +6 -6
- package/dist/components/Form/Fieldset.js +1 -1
- package/dist/components/Form/Form.js +2 -2
- package/dist/components/Form/FormElement.js +1 -1
- package/dist/components/Form/InputField.js +10 -10
- package/dist/components/Form/Inputs/Button.js +4 -4
- package/dist/components/Form/Inputs/Date.js +4 -4
- package/dist/components/Form/Inputs/FieldButtons.js +2 -2
- package/dist/components/Form/Inputs/Number.js +4 -4
- package/dist/components/Form/Inputs/ReadOnly.js +1 -1
- package/dist/components/Form/Inputs/SmallButton.js +4 -4
- package/dist/components/Form/Inputs/Text.js +4 -4
- package/dist/components/Form/Inputs/Time.js +4 -4
- package/dist/components/Form/Inputs/Toggles.js +4 -4
- package/dist/components/Form/Inputs/Translation.js +11 -11
- package/dist/components/Form/Inputs/index.js +1 -1
- package/dist/components/Form/index.js +2 -2
- package/dist/components/I18n.js +2 -2
- package/dist/components/Icon.js +3 -3
- package/dist/components/IconButton.js +3 -3
- package/dist/components/Input.js +5 -5
- package/dist/components/InternetExplorerWarningMessage.js +1 -1
- package/dist/components/List/DataCell.js +2 -2
- package/dist/components/List/HeadCell.js +2 -2
- package/dist/components/List/HeadRow.js +1 -1
- package/dist/components/List/List.js +5 -5
- package/dist/components/List/Row.js +2 -2
- package/dist/components/List/enhanceColumnDefs.js +2 -2
- package/dist/components/List/index.js +2 -2
- package/dist/components/Loader.js +6 -6
- package/dist/components/LoadingIcon.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/Badge.js +4 -4
- package/dist/components/MaterialUI/DataDisplay/Chip.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/CollapsableList.js +6 -6
- package/dist/components/MaterialUI/DataDisplay/Divider.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/Icon.js +4 -4
- package/dist/components/MaterialUI/DataDisplay/List.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/Modal.js +4 -4
- package/dist/components/MaterialUI/DataDisplay/Notification.js +8 -8
- package/dist/components/MaterialUI/DataDisplay/NotificationProps.js +6 -6
- package/dist/components/MaterialUI/DataDisplay/PopperedElements/PopperedIcon.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ActionModal.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Address.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ConfirmationModal.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/DiscountedPrice.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +3 -3
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.js +4 -4
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/SectionTitle.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +28 -12
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +9 -9
- package/dist/components/MaterialUI/DataDisplay/SelectionList.js +17 -25
- package/dist/components/MaterialUI/DataDisplay/Table.js +9 -9
- package/dist/components/MaterialUI/DataDisplay/TableHeaderCell.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +6 -6
- package/dist/components/MaterialUI/DataDisplay/Timeline.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/TimelineItem.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +7 -7
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedIcon.js +4 -4
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedTypography.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/TransferList.js +9 -9
- package/dist/components/MaterialUI/DataDisplay/chipProps.js +6 -6
- package/dist/components/MaterialUI/DataDisplay/collapsableListProps.js +6 -6
- package/dist/components/MaterialUI/DataDisplay/dividerProps.js +6 -6
- package/dist/components/MaterialUI/DataDisplay/index.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/modalProps.js +6 -6
- package/dist/components/MaterialUI/DataDisplay/tableHelpers.js +9 -5
- package/dist/components/MaterialUI/DataDisplay/useTableSelection.js +6 -6
- package/dist/components/MaterialUI/Feedback/NotificationContext.js +6 -6
- package/dist/components/MaterialUI/Feedback/loadingScreen.js +6 -6
- package/dist/components/MaterialUI/Inputs/Autocomplete.js +5 -5
- package/dist/components/MaterialUI/Inputs/AutocompleteProps.js +6 -6
- package/dist/components/MaterialUI/Inputs/Checkbox.js +4 -4
- package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +4 -4
- package/dist/components/MaterialUI/Inputs/CheckboxGroupProps.js +6 -6
- package/dist/components/MaterialUI/Inputs/CheckboxProps.js +6 -6
- package/dist/components/MaterialUI/Inputs/DatePicker.js +15 -16
- package/dist/components/MaterialUI/Inputs/InputBase.js +11 -11
- package/dist/components/MaterialUI/Inputs/InputBaseProps.js +6 -6
- package/dist/components/MaterialUI/Inputs/LookupSelect.js +3 -3
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +2 -2
- package/dist/components/MaterialUI/Inputs/PredefinedElements/TitledSelect.js +1 -1
- package/dist/components/MaterialUI/Inputs/Radio.js +4 -3
- package/dist/components/MaterialUI/Inputs/RadioProps.js +6 -6
- package/dist/components/MaterialUI/Inputs/Select.js +23 -10
- package/dist/components/MaterialUI/Inputs/SelectProps.js +8 -7
- package/dist/components/MaterialUI/Inputs/StandaloneRadio.js +4 -4
- package/dist/components/MaterialUI/Inputs/Switch.js +32 -20
- package/dist/components/MaterialUI/Inputs/SwitchProps.js +6 -6
- package/dist/components/MaterialUI/Inputs/TimePicker.js +7 -7
- package/dist/components/MaterialUI/Inputs/createInput.js +5 -5
- package/dist/components/MaterialUI/Inputs/index.js +1 -1
- package/dist/components/MaterialUI/Inputs/standaloneRadioProps.js +6 -6
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +6 -6
- package/dist/components/MaterialUI/Navigation/DropDownMenuProps.js +6 -6
- package/dist/components/MaterialUI/Navigation/ExternalLink.js +1 -1
- package/dist/components/MaterialUI/Navigation/PredefinedElements/ActionMenu.js +1 -1
- package/dist/components/MaterialUI/Navigation/TabBar.js +60 -38
- package/dist/components/MaterialUI/Navigation/TabLabel.js +5 -5
- package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -1
- package/dist/components/MaterialUI/ScopeSelector/ScopeTreeView.js +5 -5
- package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +12 -6
- package/dist/components/MaterialUI/Surfaces/ExpansionPanel.js +5 -5
- package/dist/components/MaterialUI/Surfaces/Paper.js +2 -2
- package/dist/components/MaterialUI/Surfaces/PredefinedElements/TitledPaper.js +1 -1
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +5 -5
- package/dist/components/MaterialUI/Surfaces/expansionPanelProps.js +7 -7
- package/dist/components/MaterialUI/Surfaces/paperProps.js +6 -6
- package/dist/components/MaterialUI/componentProps.js +2 -2
- package/dist/components/MaterialUI/hocs/withDeferredPopper.js +10 -16
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +9 -9
- package/dist/components/MaterialUI/muiThemes.js +2 -2
- package/dist/components/MaterialUI/textProps.js +6 -6
- package/dist/components/Modal/Background.js +1 -1
- package/dist/components/Modal/Dialog.js +2 -2
- package/dist/components/Modal/Wrapper.js +2 -2
- package/dist/components/Modal/index.js +6 -6
- package/dist/components/Modules.js +9 -9
- package/dist/components/MultiSelector.js +9 -9
- package/dist/components/Navigation/Bar.js +8 -8
- package/dist/components/Navigation/Tab.js +8 -8
- package/dist/components/Navigation/index.js +1 -1
- package/dist/components/Navigation/useNavigationState.js +8 -8
- package/dist/components/Placeholder.js +5 -5
- package/dist/components/Provision.js +1 -1
- package/dist/components/Routing/FullPage.js +1 -1
- package/dist/components/Routing/Page.js +7 -7
- package/dist/components/Routing/Segment.js +2 -2
- package/dist/components/Routing/SegmentPage.js +10 -10
- package/dist/components/Routing/SubPage.js +5 -5
- package/dist/components/Routing/withWaypointing.js +4 -4
- package/dist/components/Scope/ScopeModificationConfirmationDialog.js +1 -1
- package/dist/components/Scope/ScopeNode.js +6 -6
- package/dist/components/Scope/Selector.js +1 -1
- package/dist/components/Scope/index.js +8 -8
- package/dist/components/Scope/useScopeConfirmationModalState.js +10 -10
- package/dist/components/Scope/useScopeSelect.js +1 -1
- package/dist/components/ScopeExtendedConfigurationLoader.js +5 -5
- package/dist/components/Selector.js +9 -9
- package/dist/components/Sidepanel.js +2 -2
- package/dist/components/Spritesheet.js +1 -1
- package/dist/components/Switch.js +5 -5
- package/dist/components/TaskDetailsModal.js +2 -2
- package/dist/components/Text.js +6 -6
- package/dist/components/ToastList.js +9 -6
- package/dist/components/Toolbar.js +5 -5
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/Treeview/Branch.js +1 -1
- package/dist/components/Treeview/Label.js +2 -2
- package/dist/components/Treeview/Leaf.js +1 -1
- package/dist/components/Treeview/Node.js +6 -6
- package/dist/components/Treeview/index.js +10 -10
- package/dist/constants.js +7 -1
- package/dist/getThemeOverrides.js +2 -2
- package/dist/hocs/withAuthentication.js +2 -2
- package/dist/hocs/withClickOutside.js +4 -4
- package/dist/hocs/withErrorBoundary.js +7 -7
- package/dist/hocs/withId.js +4 -4
- package/dist/hocs/withNavigationLink.js +5 -5
- package/dist/hocs/withScopeData.js +5 -5
- package/dist/hocs/withScrollBox.js +4 -4
- package/dist/hocs/withToggle.js +7 -7
- package/dist/hocs/withUpdateHandler.js +2 -2
- package/dist/hocs/withViewState.js +5 -5
- package/dist/hooks/useEditState.js +2 -2
- package/dist/hooks/useEntityLoader.js +7 -7
- package/dist/hooks/useFullEntityEditState.js +7 -7
- package/dist/hooks/useInfiniteScroll.js +4 -4
- package/dist/hooks/useLabelMessage.js +3 -3
- package/dist/hooks/useMultipleFieldEditState.js +2 -2
- package/dist/hooks/useNotificationRequestState.js +3 -3
- package/dist/hooks/useRequestState.js +1 -1
- package/dist/hooks/useScopeGuardLoader.js +1 -1
- package/dist/hooks/useSelectorAndUnwrap.js +1 -1
- package/dist/hooks/useToggle.js +4 -4
- package/dist/reducers/applications.js +1 -1
- package/dist/reducers/authentication.js +5 -5
- package/dist/reducers/countries.js +1 -1
- package/dist/reducers/globalErrorMessages.js +1 -1
- package/dist/reducers/localeFactory.js +1 -1
- package/dist/reducers/metadata.js +6 -6
- package/dist/reducers/modules.js +1 -1
- package/dist/reducers/navigation.js +1 -1
- package/dist/reducers/request.js +1 -1
- package/dist/reducers/requestStates.js +1 -1
- package/dist/reducers/scopeRouteState.js +1 -1
- package/dist/reducers/scopes.js +1 -1
- package/dist/reducers/scopesExtendedConfiguration.js +1 -1
- package/dist/reducers/settings.js +1 -1
- package/dist/reducers/tasks.js +1 -1
- package/dist/reducers/timezones.js +1 -1
- package/dist/reducers/toasts.js +1 -1
- package/dist/reducers/versionInfo.js +1 -1
- package/dist/reducers/view.js +1 -1
- package/dist/selectors/locale.js +1 -1
- package/dist/selectors/metadata.js +3 -3
- package/dist/selectors/modules.js +2 -2
- package/dist/selectors/navigation.js +1 -1
- package/dist/selectors/route.js +1 -1
- package/dist/selectors/scope.js +1 -1
- package/dist/selectors/tasks.js +1 -1
- package/dist/utils/buildUrl.js +19 -5
- package/dist/utils/flatten.js +6 -6
- package/dist/utils/index.js +1 -1
- package/dist/utils/inputHelper.js +14 -2
- package/dist/utils/logPass.js +1 -1
- package/dist/utils/memoize.js +1 -1
- package/dist/utils/modelValidationHelper.js +2 -2
- package/dist/utils/normalizeForSearch.js +4 -1
- package/dist/utils/propertyBagHelper.js +4 -4
- package/dist/utils/propertyHelper.js +6 -6
- package/dist/utils/propertyValidator.js +1 -1
- package/dist/utils/setTranslation.js +3 -3
- package/dist/utils/setTranslationWithFallback.js +3 -3
- package/dist/utils/stripKey.js +3 -3
- package/dist/utils/styledPropFuncs.js +1 -1
- package/dist/utils/testUtils.js +8 -5
- package/dist/utils/timezoneHelper.js +6 -6
- package/dist/utils/unwrapImmutable.js +1 -1
- package/dist/utils/urlHelper.js +3 -3
- package/dist/whyDidYouRerender.js +1 -1
- package/package.json +2 -2
- package/src/components/AppFrame/ConnectedToastList.test.js +3 -1
- package/src/components/DropMenu/DropMenu.test.js +2 -0
- package/src/components/Form/InputField.js +1 -1
- package/src/components/Form/InputField.test.js +1 -1
- package/src/components/MaterialUI/DataDisplay/Badge.js +1 -1
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +33 -6
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.test.js +202 -0
- package/src/components/MaterialUI/DataDisplay/SelectionList.js +6 -20
- package/src/components/MaterialUI/DataDisplay/SelectionList.test.js +0 -6
- package/src/components/MaterialUI/DataDisplay/tableHelpers.js +14 -4
- package/src/components/MaterialUI/Feedback/loadingScreen.test.js +1 -0
- package/src/components/MaterialUI/Feedback/useNotification.test.js +1 -0
- package/src/components/MaterialUI/Inputs/DatePicker.js +16 -4
- package/src/components/MaterialUI/Inputs/DatePicker.test.js +35 -1
- package/src/components/MaterialUI/Inputs/Radio.js +1 -1
- package/src/components/MaterialUI/Inputs/Radio.test.js +35 -1
- package/src/components/MaterialUI/Inputs/Select.js +13 -1
- package/src/components/MaterialUI/Inputs/Select.test.js +37 -0
- package/src/components/MaterialUI/Inputs/SelectProps.js +1 -0
- package/src/components/MaterialUI/Inputs/Switch.js +28 -6
- package/src/components/MaterialUI/Inputs/Switch.test.js +39 -0
- package/src/components/MaterialUI/Navigation/TabBar.js +55 -34
- package/src/components/MaterialUI/ScopeSelector/TreeItem.js +6 -2
- package/src/components/MaterialUI/ScopeSelector/TreeItem.test.js +39 -0
- package/src/components/MaterialUI/hocs/withDeferredPopper.js +1 -4
- package/src/components/MaterialUI/hocs/withDeferredPopper.test.js +2 -0
- package/src/components/Modal/Modal.test.js +3 -1
- package/src/components/Modal/Wrapper.test.js +3 -1
- package/src/components/Routing/SegmentPage.js +1 -1
- package/src/components/Scope/Scope.test.js +3 -1
- package/src/components/Sidepanel.test.js +3 -1
- package/src/components/ToastList.js +2 -2
- package/src/constants.js +5 -0
- package/src/hocs/withErrorBoundary.test.js +4 -3
- package/src/hooks/useEditState.test.js +2 -0
- package/src/hooks/useLabelMessage.test.js +2 -0
- package/src/utils/buildUrl.js +15 -0
- package/src/utils/buildUrl.test.js +27 -1
- package/src/utils/inputHelper.js +18 -2
- package/src/utils/inputHelper.test.js +18 -2
- package/src/utils/normalizeForSearch.js +2 -0
- package/src/utils/propertyBagHelper.js +6 -3
- package/src/utils/propertyHelper.js +6 -6
- package/src/utils/testUtils.js +25 -22
- package/src/utils/testUtils.test.js +4 -4
|
@@ -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
|
|
|
@@ -168,7 +168,7 @@ const SegmentPage = ({
|
|
|
168
168
|
modulePrependPath,
|
|
169
169
|
entityIdResolver,
|
|
170
170
|
}) => {
|
|
171
|
-
const classes = useStyles({ isComponentNull:
|
|
171
|
+
const classes = useStyles({ isComponentNull: !View });
|
|
172
172
|
const pattern = new UrlPattern(path);
|
|
173
173
|
const baseHref = pattern.stringify(match.params);
|
|
174
174
|
const pages = [],
|
|
@@ -121,7 +121,9 @@ beforeEach(() => {
|
|
|
121
121
|
afterEach(() => {
|
|
122
122
|
try {
|
|
123
123
|
ReactDOM.unmountComponentAtNode(appRoot);
|
|
124
|
-
} catch
|
|
124
|
+
} catch {
|
|
125
|
+
// don't do anything
|
|
126
|
+
}
|
|
125
127
|
document.body.removeChild(appRoot);
|
|
126
128
|
document.body.removeChild(modalRoot);
|
|
127
129
|
});
|
|
@@ -104,8 +104,8 @@ const ListWrapper = styled(TransitionGroup)`
|
|
|
104
104
|
export const ToastList = ({ toasts }) =>
|
|
105
105
|
ReactDOM.createPortal(
|
|
106
106
|
<ListWrapper>
|
|
107
|
-
{toasts.map(props => (
|
|
108
|
-
<Toast {...props} />
|
|
107
|
+
{toasts.map((props, idx) => (
|
|
108
|
+
<Toast key={"toast" + idx} {...props} />
|
|
109
109
|
))}
|
|
110
110
|
</ListWrapper>,
|
|
111
111
|
portal,
|
package/src/constants.js
CHANGED
|
@@ -28,9 +28,10 @@ describe("withErrorBoundary", () => {
|
|
|
28
28
|
{ args: ["Caught an error: Fail, at boundary Failed"] },
|
|
29
29
|
{
|
|
30
30
|
args: [
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
31
|
+
expect.it(
|
|
32
|
+
"to match",
|
|
33
|
+
/at FailBall.*withErrorBoundary\.test\.js.*at ErrorBoundary.*withErrorBoundary\.js.*at BoundedFailBall/s,
|
|
34
|
+
),
|
|
34
35
|
],
|
|
35
36
|
},
|
|
36
37
|
]);
|
package/src/utils/buildUrl.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { applications } from "../constants";
|
|
2
|
+
|
|
1
3
|
/* Constructs a URL search string from an object with key value pairs */
|
|
2
4
|
const buildParamString = params =>
|
|
3
5
|
Object.entries(params)
|
|
@@ -32,6 +34,19 @@ export const loadConfig = () =>
|
|
|
32
34
|
`${host}/${pathParts.join("/")}` + (parameters ? "?" + buildParamString(parameters) : "");
|
|
33
35
|
});
|
|
34
36
|
|
|
37
|
+
export const buildExternalAppUrl = (app, relativeUrl) => {
|
|
38
|
+
const url = relativeUrl[0] === "/" ? relativeUrl.substring(1) : relativeUrl;
|
|
39
|
+
|
|
40
|
+
let lowercaseApp = app.toLowerCase();
|
|
41
|
+
switch (lowercaseApp) {
|
|
42
|
+
case applications.oms:
|
|
43
|
+
case applications.pim:
|
|
44
|
+
return `/${lowercaseApp}/app/${url}`;
|
|
45
|
+
default:
|
|
46
|
+
throw new Error("Not implemented app '" + app + "'");
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
35
50
|
/* Reset function for testing, never use this in actual code */
|
|
36
51
|
export const resetConfig = () => {
|
|
37
52
|
buildUrl = placeholder;
|
|
@@ -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
|
});
|
package/src/utils/inputHelper.js
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
export const trimSpacesAndLeadingZeros = (value, fallback = "") => {
|
|
2
|
-
|
|
3
|
-
|
|
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);
|
|
4
20
|
};
|
|
5
21
|
|
|
6
22
|
export const limitNumericValueLength = (value, maximum = 9) => value.substring(0, maximum);
|
|
@@ -5,14 +5,26 @@ describe("Numeric Input Helper", () => {
|
|
|
5
5
|
expect(trimSpacesAndLeadingZeros, "when called with", [" 00013 "], "to equal", "13");
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
it("trimSpacesAndLeadingZeros trims spaces and leading zeros returning
|
|
9
|
-
expect(trimSpacesAndLeadingZeros, "when called with", [" 000 ", "def"], "to equal", "
|
|
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");
|
|
10
18
|
});
|
|
11
19
|
|
|
12
20
|
it("trimSpacesAndLeadingZeros should work on floating values", () => {
|
|
13
21
|
expect(trimSpacesAndLeadingZeros, "when called with", ["042.2", "def"], "to equal", "42.2");
|
|
14
22
|
});
|
|
15
23
|
|
|
24
|
+
it("trimSpacesAndLeadingZeros should work on negative values", () => {
|
|
25
|
+
expect(trimSpacesAndLeadingZeros, "when called with", ["-0012.2", "def"], "to equal", "-12.2");
|
|
26
|
+
});
|
|
27
|
+
|
|
16
28
|
it("trimSpacesAndLeadingZeros returns fallback on null value", () => {
|
|
17
29
|
expect(trimSpacesAndLeadingZeros, "when called with", [null, "def"], "to equal", "def");
|
|
18
30
|
});
|
|
@@ -21,6 +33,10 @@ describe("Numeric Input Helper", () => {
|
|
|
21
33
|
expect(trimSpacesAndLeadingZeros, "when called with", [undefined, "def"], "to equal", "def");
|
|
22
34
|
});
|
|
23
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
|
+
|
|
24
40
|
it("limitNumericValueLength trims extra characters", () => {
|
|
25
41
|
expect(limitNumericValueLength, "when called with", ["01234567890"], "to equal", "012345678");
|
|
26
42
|
});
|
|
@@ -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
|
|
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 (
|
|
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 =
|
|
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
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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
|
}
|
package/src/utils/testUtils.js
CHANGED
|
@@ -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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
|
|
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
|
|
190
|
+
<dd>string "foo"</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
|
|
201
|
+
<dd>string "testProps"</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
|
|
264
|
+
<dd>string "bar"</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
|
|
278
|
+
<dd>string "false"</dd>
|
|
279
279
|
<dt>foo:</dt>
|
|
280
280
|
<dd>boolean true</dd>
|
|
281
281
|
</dl>
|