orc-shared 5.8.0-dev.2 → 5.8.0-dev.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/applications.js +5 -5
- package/dist/actions/authentication.js +5 -5
- package/dist/actions/countries.js +5 -5
- package/dist/actions/locale.js +5 -5
- package/dist/actions/makeApiAction.js +8 -8
- package/dist/actions/makeOrcApiAction.js +3 -3
- package/dist/actions/metadata.js +8 -8
- package/dist/actions/navigation.js +3 -3
- package/dist/actions/scopes.js +5 -5
- package/dist/actions/tasks.js +5 -5
- package/dist/actions/timezones.js +5 -5
- package/dist/actions/versionInfo.js +5 -5
- package/dist/buildStore.js +5 -5
- package/dist/components/AppFrame/About.js +14 -13
- package/dist/components/AppFrame/Anchor.js +1 -1
- package/dist/components/AppFrame/AppFrame.js +6 -6
- package/dist/components/AppFrame/ApplicationSelector/ApplicationDialog.js +1 -1
- package/dist/components/AppFrame/ApplicationSelector/Header.js +4 -4
- package/dist/components/AppFrame/ApplicationSelector/index.js +3 -3
- package/dist/components/AppFrame/ConnectedToastList.js +2 -2
- package/dist/components/AppFrame/Help.js +1 -1
- package/dist/components/AppFrame/MenuItem.js +6 -6
- package/dist/components/AppFrame/Preferences.js +8 -9
- package/dist/components/AppFrame/Sidebar.js +5 -5
- package/dist/components/AppFrame/Topbar.js +3 -3
- package/dist/components/AppFrame/index.js +2 -2
- package/dist/components/ApplicationModuleLoader.js +5 -5
- package/dist/components/Authenticate.js +2 -2
- package/dist/components/Button.js +1 -1
- package/dist/components/CategoryList.js +6 -6
- package/dist/components/Checkbox.js +5 -5
- package/dist/components/ColumnWrapper.js +1 -1
- package/dist/components/Culture.js +1 -1
- package/dist/components/DevPages.js +1 -1
- package/dist/components/DropMenu/Menu.js +2 -2
- package/dist/components/DropMenu/index.js +5 -5
- package/dist/components/ErrorPlaceholder.js +4 -4
- package/dist/components/Form/Combination.js +2 -2
- package/dist/components/Form/Field.js +3 -3
- package/dist/components/Form/FieldElements.js +4 -4
- package/dist/components/Form/FieldList.js +10 -11
- package/dist/components/Form/Fieldset.js +1 -1
- package/dist/components/Form/Form.js +2 -2
- package/dist/components/Form/FormElement.js +1 -1
- package/dist/components/Form/InputField.js +10 -10
- package/dist/components/Form/Inputs/Button.js +4 -4
- package/dist/components/Form/Inputs/Date.js +4 -4
- package/dist/components/Form/Inputs/FieldButtons.js +2 -2
- package/dist/components/Form/Inputs/Number.js +4 -4
- package/dist/components/Form/Inputs/ReadOnly.js +1 -1
- package/dist/components/Form/Inputs/SmallButton.js +4 -4
- package/dist/components/Form/Inputs/Text.js +4 -5
- package/dist/components/Form/Inputs/Time.js +4 -4
- package/dist/components/Form/Inputs/Toggles.js +4 -4
- package/dist/components/Form/Inputs/Translation.js +12 -12
- package/dist/components/Form/Inputs/index.js +1 -1
- package/dist/components/Form/index.js +2 -2
- package/dist/components/I18n.js +2 -2
- package/dist/components/Icon.js +3 -3
- package/dist/components/IconButton.js +3 -3
- package/dist/components/Input.js +5 -5
- package/dist/components/InternetExplorerWarningMessage.js +1 -1
- package/dist/components/List/DataCell.js +2 -2
- package/dist/components/List/HeadCell.js +2 -2
- package/dist/components/List/HeadRow.js +1 -1
- package/dist/components/List/List.js +5 -5
- package/dist/components/List/Row.js +2 -2
- package/dist/components/List/enhanceColumnDefs.js +3 -3
- package/dist/components/List/index.js +2 -2
- package/dist/components/Loader.js +6 -6
- package/dist/components/LoadingIcon.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/Badge.js +4 -4
- package/dist/components/MaterialUI/DataDisplay/Chip.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/CollapsableList.js +6 -6
- package/dist/components/MaterialUI/DataDisplay/Divider.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/Icon.js +4 -4
- package/dist/components/MaterialUI/DataDisplay/List.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/Modal.js +5 -5
- package/dist/components/MaterialUI/DataDisplay/Notification.js +9 -9
- package/dist/components/MaterialUI/DataDisplay/NotificationProps.js +7 -7
- package/dist/components/MaterialUI/DataDisplay/PopperedElements/PopperedIcon.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ActionModal.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Address.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ConfirmationModal.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/DiscountedPrice.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +24 -14
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.js +4 -4
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/SectionTitle.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +25 -11
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +10 -10
- package/dist/components/MaterialUI/DataDisplay/SelectionList.js +17 -25
- package/dist/components/MaterialUI/DataDisplay/Table.js +9 -9
- package/dist/components/MaterialUI/DataDisplay/TableHeaderCell.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +7 -7
- package/dist/components/MaterialUI/DataDisplay/Timeline.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/TimelineItem.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +7 -7
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedIcon.js +4 -4
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedTypography.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/TransferList.js +10 -10
- package/dist/components/MaterialUI/DataDisplay/chipProps.js +7 -7
- package/dist/components/MaterialUI/DataDisplay/collapsableListProps.js +7 -7
- package/dist/components/MaterialUI/DataDisplay/dividerProps.js +7 -7
- package/dist/components/MaterialUI/DataDisplay/index.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/modalProps.js +7 -7
- package/dist/components/MaterialUI/DataDisplay/tableHelpers.js +9 -5
- package/dist/components/MaterialUI/DataDisplay/useTableSelection.js +7 -7
- package/dist/components/MaterialUI/Feedback/NotificationContext.js +6 -6
- package/dist/components/MaterialUI/Feedback/loadingScreen.js +6 -6
- package/dist/components/MaterialUI/Inputs/Autocomplete.js +6 -6
- package/dist/components/MaterialUI/Inputs/AutocompleteProps.js +7 -7
- package/dist/components/MaterialUI/Inputs/Checkbox.js +5 -5
- package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +5 -5
- package/dist/components/MaterialUI/Inputs/CheckboxGroupProps.js +7 -7
- package/dist/components/MaterialUI/Inputs/CheckboxProps.js +7 -7
- package/dist/components/MaterialUI/Inputs/DatePicker.js +16 -17
- package/dist/components/MaterialUI/Inputs/InputBase.js +15 -12
- package/dist/components/MaterialUI/Inputs/InputBaseProps.js +7 -7
- package/dist/components/MaterialUI/Inputs/LookupSelect.js +3 -3
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +2 -2
- package/dist/components/MaterialUI/Inputs/PredefinedElements/TitledSelect.js +1 -1
- package/dist/components/MaterialUI/Inputs/Radio.js +2 -2
- package/dist/components/MaterialUI/Inputs/RadioProps.js +7 -7
- package/dist/components/MaterialUI/Inputs/Select.js +24 -11
- package/dist/components/MaterialUI/Inputs/SelectProps.js +9 -8
- package/dist/components/MaterialUI/Inputs/StandaloneRadio.js +5 -5
- package/dist/components/MaterialUI/Inputs/Switch.js +33 -21
- package/dist/components/MaterialUI/Inputs/SwitchProps.js +7 -7
- package/dist/components/MaterialUI/Inputs/TimePicker.js +7 -7
- package/dist/components/MaterialUI/Inputs/createInput.js +6 -6
- package/dist/components/MaterialUI/Inputs/index.js +1 -1
- package/dist/components/MaterialUI/Inputs/standaloneRadioProps.js +7 -7
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +6 -6
- package/dist/components/MaterialUI/Navigation/DropDownMenuProps.js +7 -7
- package/dist/components/MaterialUI/Navigation/ExternalLink.js +1 -1
- package/dist/components/MaterialUI/Navigation/PredefinedElements/ActionMenu.js +1 -1
- package/dist/components/MaterialUI/Navigation/TabBar.js +60 -38
- package/dist/components/MaterialUI/Navigation/TabLabel.js +5 -5
- package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -1
- package/dist/components/MaterialUI/ScopeSelector/ScopeTreeView.js +5 -5
- package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +13 -8
- package/dist/components/MaterialUI/Surfaces/ExpansionPanel.js +5 -5
- package/dist/components/MaterialUI/Surfaces/Paper.js +2 -2
- package/dist/components/MaterialUI/Surfaces/PredefinedElements/TitledPaper.js +1 -1
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +5 -5
- package/dist/components/MaterialUI/Surfaces/expansionPanelProps.js +8 -8
- package/dist/components/MaterialUI/Surfaces/paperProps.js +7 -7
- package/dist/components/MaterialUI/componentProps.js +3 -3
- package/dist/components/MaterialUI/hocs/withDeferredPopper.js +10 -16
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +10 -9
- package/dist/components/MaterialUI/muiThemes.js +3 -3
- package/dist/components/MaterialUI/textProps.js +7 -7
- package/dist/components/Modal/Background.js +1 -1
- package/dist/components/Modal/Dialog.js +2 -2
- package/dist/components/Modal/Wrapper.js +2 -2
- package/dist/components/Modal/index.js +6 -6
- package/dist/components/Modules.js +9 -9
- package/dist/components/MultiSelector.js +9 -9
- package/dist/components/Navigation/Bar.js +9 -9
- package/dist/components/Navigation/Tab.js +8 -8
- package/dist/components/Navigation/index.js +2 -1
- package/dist/components/Navigation/useNavigationState.js +9 -9
- package/dist/components/Placeholder.js +5 -5
- package/dist/components/Provision.js +1 -1
- package/dist/components/Routing/FullPage.js +1 -1
- package/dist/components/Routing/Page.js +7 -7
- package/dist/components/Routing/Segment.js +2 -2
- package/dist/components/Routing/SegmentPage.js +11 -11
- package/dist/components/Routing/SubPage.js +5 -5
- package/dist/components/Routing/withWaypointing.js +5 -5
- package/dist/components/Scope/ScopeModificationConfirmationDialog.js +1 -1
- package/dist/components/Scope/ScopeNode.js +6 -6
- package/dist/components/Scope/Selector.js +1 -1
- package/dist/components/Scope/index.js +9 -9
- package/dist/components/Scope/useScopeConfirmationModalState.js +10 -10
- package/dist/components/Scope/useScopeSelect.js +1 -1
- package/dist/components/ScopeExtendedConfigurationLoader.js +5 -5
- package/dist/components/Selector.js +9 -9
- package/dist/components/Sidepanel.js +2 -2
- package/dist/components/Spritesheet.js +1 -1
- package/dist/components/Switch.js +5 -5
- package/dist/components/TaskDetailsModal.js +2 -2
- package/dist/components/Text.js +6 -6
- package/dist/components/ToastList.js +9 -6
- package/dist/components/Toolbar.js +5 -5
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/Treeview/Branch.js +1 -1
- package/dist/components/Treeview/Label.js +2 -2
- package/dist/components/Treeview/Leaf.js +1 -1
- package/dist/components/Treeview/Node.js +7 -7
- package/dist/components/Treeview/index.js +11 -11
- package/dist/constants.js +7 -1
- package/dist/getThemeOverrides.js +3 -3
- package/dist/hocs/withAuthentication.js +2 -2
- package/dist/hocs/withClickOutside.js +4 -4
- package/dist/hocs/withErrorBoundary.js +7 -7
- package/dist/hocs/withId.js +4 -4
- package/dist/hocs/withNavigationLink.js +5 -5
- package/dist/hocs/withScopeData.js +5 -5
- package/dist/hocs/withScrollBox.js +4 -4
- package/dist/hocs/withToggle.js +8 -8
- package/dist/hocs/withUpdateHandler.js +3 -3
- package/dist/hocs/withViewState.js +5 -5
- package/dist/hooks/useEditState.js +3 -3
- package/dist/hooks/useEntityLoader.js +8 -8
- package/dist/hooks/useFullEntityEditState.js +8 -8
- package/dist/hooks/useInfiniteScroll.js +4 -4
- package/dist/hooks/useLabelMessage.js +4 -4
- package/dist/hooks/useMultipleFieldEditState.js +3 -3
- package/dist/hooks/useNotificationRequestState.js +4 -4
- package/dist/hooks/useRequestState.js +1 -1
- package/dist/hooks/useScopeGuardLoader.js +1 -1
- package/dist/hooks/useSelectorAndUnwrap.js +1 -1
- package/dist/hooks/useToggle.js +4 -4
- package/dist/reducers/applications.js +1 -1
- package/dist/reducers/authentication.js +5 -5
- package/dist/reducers/countries.js +1 -1
- package/dist/reducers/globalErrorMessages.js +1 -1
- package/dist/reducers/localeFactory.js +1 -1
- package/dist/reducers/metadata.js +18 -10
- package/dist/reducers/modules.js +1 -1
- package/dist/reducers/navigation.js +1 -1
- package/dist/reducers/request.js +1 -1
- package/dist/reducers/requestStates.js +1 -1
- package/dist/reducers/scopeRouteState.js +1 -1
- package/dist/reducers/scopes.js +1 -1
- package/dist/reducers/scopesExtendedConfiguration.js +1 -1
- package/dist/reducers/settings.js +1 -1
- package/dist/reducers/tasks.js +1 -1
- package/dist/reducers/timezones.js +1 -1
- package/dist/reducers/toasts.js +1 -1
- package/dist/reducers/versionInfo.js +1 -1
- package/dist/reducers/view.js +1 -1
- package/dist/selectors/locale.js +1 -1
- package/dist/selectors/metadata.js +4 -4
- package/dist/selectors/modules.js +3 -3
- package/dist/selectors/navigation.js +1 -1
- package/dist/selectors/route.js +1 -1
- package/dist/selectors/scope.js +1 -1
- package/dist/selectors/tasks.js +1 -1
- package/dist/utils/buildUrl.js +19 -5
- package/dist/utils/filterHelper.js +4 -2
- package/dist/utils/flatten.js +7 -7
- package/dist/utils/index.js +1 -1
- package/dist/utils/inputHelper.js +71 -0
- package/dist/utils/logPass.js +1 -1
- package/dist/utils/memoize.js +1 -1
- package/dist/utils/modelValidationHelper.js +3 -3
- package/dist/utils/normalizeForSearch.js +4 -1
- package/dist/utils/propertyBagHelper.js +4 -4
- package/dist/utils/propertyHelper.js +6 -6
- package/dist/utils/propertyValidator.js +1 -1
- package/dist/utils/setTranslation.js +3 -3
- package/dist/utils/setTranslationWithFallback.js +3 -3
- package/dist/utils/stripKey.js +4 -4
- package/dist/utils/styledPropFuncs.js +1 -1
- package/dist/utils/testUtils.js +8 -5
- package/dist/utils/timezoneHelper.js +6 -6
- package/dist/utils/unwrapImmutable.js +1 -1
- package/dist/utils/urlHelper.js +3 -3
- package/dist/whyDidYouRerender.js +1 -1
- package/package.json +2 -5
- package/src/components/AppFrame/About.js +4 -3
- package/src/components/AppFrame/About.test.js +61 -0
- package/src/components/AppFrame/ConnectedToastList.test.js +3 -1
- package/src/components/DropMenu/DropMenu.test.js +2 -0
- package/src/components/Form/InputField.js +1 -1
- package/src/components/Form/InputField.test.js +1 -1
- package/src/components/MaterialUI/DataDisplay/Badge.js +1 -1
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +29 -8
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.test.js +18 -6
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +27 -6
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.test.js +202 -0
- package/src/components/MaterialUI/DataDisplay/SelectionList.js +6 -20
- package/src/components/MaterialUI/DataDisplay/SelectionList.test.js +0 -6
- package/src/components/MaterialUI/DataDisplay/tableHelpers.js +14 -4
- package/src/components/MaterialUI/Feedback/loadingScreen.test.js +1 -0
- package/src/components/MaterialUI/Feedback/useNotification.test.js +1 -0
- package/src/components/MaterialUI/Inputs/DatePicker.js +16 -4
- package/src/components/MaterialUI/Inputs/DatePicker.test.js +35 -1
- package/src/components/MaterialUI/Inputs/InputBase.js +2 -0
- package/src/components/MaterialUI/Inputs/InputBase.test.js +49 -0
- package/src/components/MaterialUI/Inputs/Select.js +13 -1
- package/src/components/MaterialUI/Inputs/Select.test.js +37 -0
- package/src/components/MaterialUI/Inputs/SelectProps.js +1 -0
- package/src/components/MaterialUI/Inputs/Switch.js +28 -6
- package/src/components/MaterialUI/Inputs/Switch.test.js +39 -0
- package/src/components/MaterialUI/Navigation/TabBar.js +55 -34
- package/src/components/MaterialUI/ScopeSelector/TreeItem.js +6 -2
- package/src/components/MaterialUI/ScopeSelector/TreeItem.test.js +39 -0
- package/src/components/MaterialUI/hocs/withDeferredPopper.js +1 -4
- package/src/components/MaterialUI/hocs/withDeferredPopper.test.js +2 -0
- package/src/components/Modal/Modal.test.js +3 -1
- package/src/components/Modal/Wrapper.test.js +3 -1
- package/src/components/Routing/SegmentPage.js +2 -1
- package/src/components/Scope/Scope.test.js +3 -1
- package/src/components/Sidepanel.test.js +3 -1
- package/src/components/ToastList.js +2 -2
- package/src/constants.js +5 -0
- package/src/hocs/withErrorBoundary.test.js +4 -3
- package/src/hooks/useEditState.test.js +2 -0
- package/src/hooks/useLabelMessage.test.js +2 -0
- package/src/reducers/metadata.js +12 -17
- package/src/reducers/metadata.test.js +318 -156
- package/src/utils/buildUrl.js +15 -0
- package/src/utils/buildUrl.test.js +27 -1
- package/src/utils/filterHelper.js +4 -2
- package/src/utils/filterHelper.test.js +6 -6
- package/src/utils/inputHelper.js +22 -0
- package/src/utils/inputHelper.test.js +47 -0
- package/src/utils/normalizeForSearch.js +2 -0
- package/src/utils/propertyBagHelper.js +6 -3
- package/src/utils/propertyHelper.js +6 -6
- package/src/utils/testUtils.js +25 -22
- package/src/utils/testUtils.test.js +4 -4
|
@@ -1,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:
|
|
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:
|
|
47
|
-
{ value: "value3", label:
|
|
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:
|
|
64
|
-
{ value: "value6", label:
|
|
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:
|
|
81
|
-
{ value: "value3", label:
|
|
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
|
|
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>
|