orc-shared 5.7.0-dev.9 → 5.8.0-dev.12
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/requestsApi.js +743 -140
- package/dist/actions/scopes.js +30 -6
- 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 +7 -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 +3 -3
- 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 +30 -16
- 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 +6 -6
- 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 +6 -6
- 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 +15 -9
- package/dist/components/MaterialUI/Inputs/CheckboxGroupProps.js +10 -8
- package/dist/components/MaterialUI/Inputs/CheckboxProps.js +7 -7
- package/dist/components/MaterialUI/Inputs/DatePicker.js +7 -7
- package/dist/components/MaterialUI/Inputs/InputBase.js +21 -13
- 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 +17 -10
- 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 +10 -10
- package/dist/components/MaterialUI/Inputs/SelectProps.js +7 -7
- package/dist/components/MaterialUI/Inputs/StandaloneRadio.js +5 -5
- package/dist/components/MaterialUI/Inputs/Switch.js +5 -5
- 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 +4 -5
- 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 +9 -9
- 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 +3 -2
- 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 +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 +83 -0
- 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 +11 -2
- package/dist/content/icons/orckestra-icon.svg +11 -5
- 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 +68 -0
- 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 +15 -5
- 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/scopeExtendedConfiguration.js +56 -0
- package/dist/selectors/tasks.js +1 -1
- package/dist/utils/buildUrl.js +4 -4
- 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 +59 -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/propertyBagHelper.js +4 -1
- 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 +5 -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/actions/requestsApi.js +511 -89
- package/src/actions/scopes.js +25 -1
- package/src/actions/scopes.test.js +34 -0
- package/src/buildStore.js +2 -0
- package/src/components/AppFrame/About.js +4 -3
- package/src/components/AppFrame/About.test.js +61 -0
- 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/PredefinedElements/InformationItem.js +37 -10
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.test.js +47 -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/CheckboxGroup.js +5 -4
- package/src/components/MaterialUI/Inputs/CheckboxGroup.test.js +22 -0
- package/src/components/MaterialUI/Inputs/CheckboxGroupProps.js +2 -0
- package/src/components/MaterialUI/Inputs/CheckboxGroupProps.test.js +2 -2
- package/src/components/MaterialUI/Inputs/InputBase.js +10 -5
- package/src/components/MaterialUI/Inputs/InputBase.test.js +209 -110
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +13 -6
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.test.js +57 -0
- package/src/components/MaterialUI/Navigation/TabBar.js +55 -34
- package/src/components/Provision.js +2 -0
- package/src/components/Provision.test.js +7 -0
- package/src/components/Routing/SegmentPage.js +1 -0
- package/src/components/ScopeExtendedConfigurationLoader.js +22 -0
- package/src/components/ScopeExtendedConfigurationLoader.test.js +71 -0
- package/src/components/ToastList.js +2 -2
- package/src/constants.js +8 -0
- package/src/content/icons/orckestra-icon.svg +11 -5
- 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/reducers/scopesExtendedConfiguration.js +16 -0
- package/src/reducers/scopesExtendedConfiguration.test.js +31 -0
- package/src/selectors/metadata.js +9 -0
- package/src/selectors/metadata.test.js +90 -0
- package/src/selectors/scopeExtendedConfiguration.js +9 -0
- package/src/selectors/scopeExtendedConfiguration.test.js +45 -0
- package/src/utils/filterHelper.js +4 -2
- package/src/utils/filterHelper.test.js +6 -6
- package/src/utils/inputHelper.js +6 -0
- package/src/utils/inputHelper.test.js +31 -0
- package/src/utils/propertyBagHelper.js +3 -0
- package/src/utils/propertyBagHelper.test.js +7 -0
- package/src/utils/testUtils.test.js +4 -4
|
@@ -66,6 +66,15 @@ export const namedLookupLocalizedSelector = memoize((moduleName, lookupName, key
|
|
|
66
66
|
}),
|
|
67
67
|
);
|
|
68
68
|
|
|
69
|
+
export const lookupExistAndIsActiveSelector = memoize((moduleName, lookupName, key) =>
|
|
70
|
+
createSelector(lookupValuesSelector(moduleName, lookupName), lookups => {
|
|
71
|
+
const values = lookups.get("values");
|
|
72
|
+
if (values == null || key == null) return false;
|
|
73
|
+
const value = values.get(key);
|
|
74
|
+
return value?.get("isActive") === true;
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
77
|
+
|
|
69
78
|
export const namedLookupLocalizedValuesSelector = memoize((moduleName, lookupName) =>
|
|
70
79
|
createSelector(lookupValuesSelector(moduleName, lookupName), currentLocaleOrDefault, (lookup, locale) =>
|
|
71
80
|
(lookup.get("values") || Immutable.Map()).map(lookupValue =>
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
definitionEntityCustomAttributesSelector,
|
|
31
31
|
lookupByNameSelector,
|
|
32
32
|
mappedLookupsListSelector,
|
|
33
|
+
lookupExistAndIsActiveSelector,
|
|
33
34
|
} from "./metadata";
|
|
34
35
|
|
|
35
36
|
const lookups = {
|
|
@@ -1899,3 +1900,92 @@ describe("definitions", () => {
|
|
|
1899
1900
|
);
|
|
1900
1901
|
});
|
|
1901
1902
|
});
|
|
1903
|
+
|
|
1904
|
+
describe("lookupExistAndIsActiveSelector", () => {
|
|
1905
|
+
let state;
|
|
1906
|
+
beforeEach(() => {
|
|
1907
|
+
state = Immutable.fromJS({
|
|
1908
|
+
locale: { locale: "it-IT" },
|
|
1909
|
+
metadata: {
|
|
1910
|
+
lookups: {
|
|
1911
|
+
order: {
|
|
1912
|
+
index: {
|
|
1913
|
+
...lookups,
|
|
1914
|
+
DistanceUOM: {
|
|
1915
|
+
lookupName: "DistanceUOM",
|
|
1916
|
+
values: {
|
|
1917
|
+
Inches: {
|
|
1918
|
+
value: "Inches",
|
|
1919
|
+
displayName: {
|
|
1920
|
+
"en-CA": "inEnCa",
|
|
1921
|
+
"en-US": "inEnUS",
|
|
1922
|
+
"fr-CA": "inFrCa",
|
|
1923
|
+
"it-IT": "inItIt",
|
|
1924
|
+
},
|
|
1925
|
+
isActive: true,
|
|
1926
|
+
},
|
|
1927
|
+
},
|
|
1928
|
+
},
|
|
1929
|
+
},
|
|
1930
|
+
list: [],
|
|
1931
|
+
},
|
|
1932
|
+
},
|
|
1933
|
+
},
|
|
1934
|
+
});
|
|
1935
|
+
});
|
|
1936
|
+
|
|
1937
|
+
it("retrieves true when lookup exist and value is active", () => {
|
|
1938
|
+
expect(
|
|
1939
|
+
lookupExistAndIsActiveSelector,
|
|
1940
|
+
"when called with",
|
|
1941
|
+
["order", "DistanceUOM", "Inches"],
|
|
1942
|
+
"when called with",
|
|
1943
|
+
[state],
|
|
1944
|
+
"to be",
|
|
1945
|
+
true,
|
|
1946
|
+
);
|
|
1947
|
+
});
|
|
1948
|
+
|
|
1949
|
+
it("retrieves false when lookup exist and value is inactive", () => {
|
|
1950
|
+
state = state.setIn(
|
|
1951
|
+
["metadata", "lookups", "order", "index", "DistanceUOM", "values", "Inches", "isActive"],
|
|
1952
|
+
false,
|
|
1953
|
+
);
|
|
1954
|
+
|
|
1955
|
+
expect(
|
|
1956
|
+
lookupExistAndIsActiveSelector,
|
|
1957
|
+
"when called with",
|
|
1958
|
+
["order", "DistanceUOM", "Inches"],
|
|
1959
|
+
"when called with",
|
|
1960
|
+
[state],
|
|
1961
|
+
"to be",
|
|
1962
|
+
false,
|
|
1963
|
+
);
|
|
1964
|
+
});
|
|
1965
|
+
|
|
1966
|
+
it("retrieves false when lookup exist and its values property is null", () => {
|
|
1967
|
+
state = state.setIn(["metadata", "lookups", "order", "index", "DistanceUOM", "values"], null);
|
|
1968
|
+
|
|
1969
|
+
expect(
|
|
1970
|
+
lookupExistAndIsActiveSelector,
|
|
1971
|
+
"when called with",
|
|
1972
|
+
["order", "DistanceUOM", "Inches"],
|
|
1973
|
+
"when called with",
|
|
1974
|
+
[state],
|
|
1975
|
+
"to be",
|
|
1976
|
+
false,
|
|
1977
|
+
);
|
|
1978
|
+
});
|
|
1979
|
+
|
|
1980
|
+
it("retrieves false when lookup exist and lookup value name does not exist", () => {
|
|
1981
|
+
expect(
|
|
1982
|
+
lookupExistAndIsActiveSelector,
|
|
1983
|
+
"when called with",
|
|
1984
|
+
["order", "DistanceUOM", "unknown"],
|
|
1985
|
+
"when called with",
|
|
1986
|
+
[state],
|
|
1987
|
+
"to be",
|
|
1988
|
+
false,
|
|
1989
|
+
);
|
|
1990
|
+
});
|
|
1991
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createSelector } from "reselect";
|
|
2
|
+
|
|
3
|
+
const scopesExtendedConfigurationData = state => state.get("scopesExtendedConfiguration");
|
|
4
|
+
|
|
5
|
+
export const doesScopeHaveGeolocationProviderSelector = scopeId => {
|
|
6
|
+
return createSelector(scopesExtendedConfigurationData, scopesCfg => {
|
|
7
|
+
return scopesCfg?.get(scopeId)?.get("hasGeolocationProvider") ?? false;
|
|
8
|
+
});
|
|
9
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import Immutable from "immutable";
|
|
2
|
+
import { doesScopeHaveGeolocationProviderSelector } from "./scopeExtendedConfiguration";
|
|
3
|
+
|
|
4
|
+
let state;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
state = Immutable.fromJS({
|
|
7
|
+
navigation: {
|
|
8
|
+
route: { location: {}, match: { params: { scope: "SecondChild" } } },
|
|
9
|
+
},
|
|
10
|
+
locale: {
|
|
11
|
+
locale: "fr",
|
|
12
|
+
supportedLocales: ["en", "fr"],
|
|
13
|
+
},
|
|
14
|
+
scopesExtendedConfiguration: {
|
|
15
|
+
theScope: { hasGeolocationProvider: true },
|
|
16
|
+
},
|
|
17
|
+
settings: {
|
|
18
|
+
defaultScope: "FirstChild",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe("doesScopeHaveGeolocationProviderSelector", () => {
|
|
24
|
+
it("gets an unknown scope", () =>
|
|
25
|
+
expect(
|
|
26
|
+
doesScopeHaveGeolocationProviderSelector,
|
|
27
|
+
"when called with",
|
|
28
|
+
["Unknown"],
|
|
29
|
+
"called with",
|
|
30
|
+
[state],
|
|
31
|
+
"to be",
|
|
32
|
+
false,
|
|
33
|
+
));
|
|
34
|
+
|
|
35
|
+
it("gets a known scope", () =>
|
|
36
|
+
expect(
|
|
37
|
+
doesScopeHaveGeolocationProviderSelector,
|
|
38
|
+
"when called with",
|
|
39
|
+
["theScope"],
|
|
40
|
+
"called with",
|
|
41
|
+
[state],
|
|
42
|
+
"to be",
|
|
43
|
+
true,
|
|
44
|
+
));
|
|
45
|
+
});
|
|
@@ -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,6 @@
|
|
|
1
|
+
export const trimSpacesAndLeadingZeros = (value, fallback = "") => {
|
|
2
|
+
const trimmed = (value ?? "").trim().replace(/^0+/, "");
|
|
3
|
+
return trimmed === "" ? fallback : limitNumericValueLength(trimmed);
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export const limitNumericValueLength = (value, maximum = 9) => value.substring(0, maximum);
|
|
@@ -0,0 +1,31 @@
|
|
|
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 fallback value", () => {
|
|
9
|
+
expect(trimSpacesAndLeadingZeros, "when called with", [" 000 ", "def"], "to equal", "def");
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("trimSpacesAndLeadingZeros should work on floating values", () => {
|
|
13
|
+
expect(trimSpacesAndLeadingZeros, "when called with", ["042.2", "def"], "to equal", "42.2");
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("trimSpacesAndLeadingZeros returns fallback on null value", () => {
|
|
17
|
+
expect(trimSpacesAndLeadingZeros, "when called with", [null, "def"], "to equal", "def");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("trimSpacesAndLeadingZeros returns fallback on undefined value", () => {
|
|
21
|
+
expect(trimSpacesAndLeadingZeros, "when called with", [undefined, "def"], "to equal", "def");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("limitNumericValueLength trims extra characters", () => {
|
|
25
|
+
expect(limitNumericValueLength, "when called with", ["01234567890"], "to equal", "012345678");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("limitNumericValueLength trims extra characters with another maximum", () => {
|
|
29
|
+
expect(limitNumericValueLength, "when called with", ["01234567890", 5], "to equal", "01234");
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -49,7 +49,10 @@ export const toJsonCargo = (attribute, value) => {
|
|
|
49
49
|
switch (attribute.dataType) {
|
|
50
50
|
case attributeDataType.text:
|
|
51
51
|
case attributeDataType.lookup:
|
|
52
|
+
case attributeDataType.singleChoice:
|
|
52
53
|
return value;
|
|
54
|
+
case attributeDataType.multipleChoice:
|
|
55
|
+
return createJsonCargo(jsonCargoType.stringArray, value);
|
|
53
56
|
|
|
54
57
|
case attributeDataType.boolean:
|
|
55
58
|
return createJsonCargo(jsonCargoType.boolean, value);
|
|
@@ -123,6 +123,13 @@ describe("toJsonCargo function", () => {
|
|
|
123
123
|
tiers: [{ min: "2", rate: "2" }],
|
|
124
124
|
},
|
|
125
125
|
],
|
|
126
|
+
["aRadioValue", attributeDataType.singleChoice, null, "aRadioValue"],
|
|
127
|
+
[
|
|
128
|
+
["aCheckboxValue1", "aCheckboxValue1"],
|
|
129
|
+
attributeDataType.multipleChoice,
|
|
130
|
+
null,
|
|
131
|
+
{ __type: "ValueOfString[]", value: ["aCheckboxValue1", "aCheckboxValue1"] },
|
|
132
|
+
],
|
|
126
133
|
])("should return the proper json cargo with %s of type %s", (value, dataType, customType, expectedCargo) => {
|
|
127
134
|
const attribute = {
|
|
128
135
|
dataType: dataType,
|
|
@@ -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>
|