orc-shared 1.4.0 → 1.5.0-dev.10
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 +14 -52
- package/dist/actions/authentication.js +10 -45
- package/dist/actions/countries.js +6 -36
- package/dist/actions/locale.js +14 -54
- package/dist/actions/makeApiAction.js +31 -79
- package/dist/actions/makeOrcApiAction.js +3 -26
- package/dist/actions/metadata.js +65 -174
- package/dist/actions/modules.js +0 -26
- package/dist/actions/navigation.js +3 -33
- package/dist/actions/requestState.js +0 -18
- package/dist/actions/requestsApi.js +0 -17
- package/dist/actions/scopes.js +14 -56
- package/dist/actions/timezones.js +6 -36
- package/dist/actions/toasts.js +3 -23
- package/dist/actions/versionInfo.js +6 -39
- package/dist/actions/view.js +0 -38
- package/dist/buildStore.js +3 -53
- package/dist/components/AppFrame/About.js +8 -70
- package/dist/components/AppFrame/Anchor.js +1 -25
- package/dist/components/AppFrame/AppFrame.js +23 -92
- package/dist/components/AppFrame/ApplicationSelector/ApplicationDialog.js +4 -35
- package/dist/components/AppFrame/ApplicationSelector/Header.js +1 -31
- package/dist/components/AppFrame/ApplicationSelector/index.js +1 -30
- package/dist/components/AppFrame/ConnectedToastList.js +0 -31
- package/dist/components/AppFrame/Help.js +0 -25
- package/dist/components/AppFrame/MenuItem.js +17 -70
- package/dist/components/AppFrame/Preferences.js +17 -79
- package/dist/components/AppFrame/Sidebar.js +8 -53
- package/dist/components/AppFrame/Topbar.js +9 -65
- package/dist/components/AppFrame/index.js +0 -20
- package/dist/components/AppFrame/useApplicationHelpUrl.js +0 -22
- package/dist/components/ApplicationModuleLoader.js +7 -46
- package/dist/components/Authenticate.js +5 -48
- package/dist/components/Button.js +0 -24
- package/dist/components/CategoryList.js +27 -82
- package/dist/components/Checkbox.js +3 -41
- package/dist/components/ColumnWrapper.js +0 -19
- package/dist/components/Culture.js +0 -29
- package/dist/components/DevPages.js +0 -21
- package/dist/components/DropMenu/Menu.js +4 -36
- package/dist/components/DropMenu/index.js +12 -50
- package/dist/components/ErrorPlaceholder.js +3 -31
- package/dist/components/Form/Combination.js +3 -28
- package/dist/components/Form/Field.js +6 -37
- package/dist/components/Form/FieldElements.js +9 -41
- package/dist/components/Form/FieldList.js +28 -92
- package/dist/components/Form/Fieldset.js +1 -27
- package/dist/components/Form/Form.js +6 -37
- package/dist/components/Form/FormElement.js +1 -20
- package/dist/components/Form/InputField.js +17 -66
- package/dist/components/Form/Inputs/Button.js +5 -35
- package/dist/components/Form/Inputs/Date.js +2 -28
- package/dist/components/Form/Inputs/FieldButtons.js +0 -25
- package/dist/components/Form/Inputs/Number.js +7 -46
- package/dist/components/Form/Inputs/ReadOnly.js +0 -29
- package/dist/components/Form/Inputs/SmallButton.js +6 -38
- package/dist/components/Form/Inputs/Text.js +8 -41
- package/dist/components/Form/Inputs/Time.js +4 -33
- package/dist/components/Form/Inputs/Toggles.js +5 -39
- package/dist/components/Form/Inputs/Translation.js +21 -78
- package/dist/components/Form/Inputs/index.js +0 -28
- package/dist/components/Form/index.js +0 -20
- package/dist/components/Head.js +0 -22
- package/dist/components/I18n.js +0 -28
- package/dist/components/Icon.js +1 -27
- package/dist/components/IconButton.js +2 -32
- package/dist/components/Input.js +2 -42
- package/dist/components/InternetExplorerWarningMessage.js +0 -31
- package/dist/components/List/DataCell.js +3 -42
- package/dist/components/List/HeadCell.js +3 -43
- package/dist/components/List/HeadRow.js +2 -25
- package/dist/components/List/List.js +37 -107
- package/dist/components/List/Row.js +7 -38
- package/dist/components/List/enhanceColumnDefs.js +3 -29
- package/dist/components/List/index.js +0 -20
- package/dist/components/Loader.js +5 -48
- package/dist/components/LoadingIcon.js +0 -24
- package/dist/components/MaterialUI/DataDisplay/Badge.js +2 -31
- package/dist/components/MaterialUI/DataDisplay/Chip.js +1 -33
- package/dist/components/MaterialUI/DataDisplay/CollapsableList.js +7 -51
- package/dist/components/MaterialUI/DataDisplay/Divider.js +0 -30
- package/dist/components/MaterialUI/DataDisplay/Icon.js +2 -28
- package/dist/components/MaterialUI/DataDisplay/List.js +16 -55
- package/dist/components/MaterialUI/DataDisplay/Modal.js +4 -37
- package/dist/components/MaterialUI/DataDisplay/Notification.js +17 -69
- package/dist/components/MaterialUI/DataDisplay/NotificationProps.js +3 -34
- package/dist/components/MaterialUI/DataDisplay/PopperedElements/PopperedIcon.js +0 -22
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ActionModal.js +5 -37
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Address.js +1 -33
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ConfirmationModal.js +7 -28
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/DiscountedPrice.js +2 -32
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +17 -57
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +4 -33
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/SectionTitle.js +0 -25
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +14 -60
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +0 -29
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +15 -59
- package/dist/components/MaterialUI/DataDisplay/SelectionList.js +23 -70
- package/dist/components/MaterialUI/DataDisplay/Table.js +34 -123
- package/dist/components/MaterialUI/DataDisplay/TableHeaderCell.js +0 -35
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +3 -49
- package/dist/components/MaterialUI/DataDisplay/Timeline.js +1 -21
- package/dist/components/MaterialUI/DataDisplay/TimelineItem.js +4 -32
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +7 -46
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedIcon.js +3 -29
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedTypography.js +0 -21
- package/dist/components/MaterialUI/DataDisplay/TransferList.js +32 -97
- package/dist/components/MaterialUI/DataDisplay/chipProps.js +3 -38
- package/dist/components/MaterialUI/DataDisplay/collapsableListProps.js +3 -37
- package/dist/components/MaterialUI/DataDisplay/dividerProps.js +3 -41
- package/dist/components/MaterialUI/DataDisplay/index.js +0 -33
- package/dist/components/MaterialUI/DataDisplay/modalProps.js +3 -36
- package/dist/components/MaterialUI/DataDisplay/tableHelpers.js +5 -68
- package/dist/components/MaterialUI/DataDisplay/useTableSelection.js +11 -48
- package/dist/components/MaterialUI/Feedback/NotificationContext.js +5 -40
- package/dist/components/MaterialUI/Feedback/loadingScreen.js +5 -44
- package/dist/components/MaterialUI/Feedback/useNotification.js +0 -21
- package/dist/components/MaterialUI/Inputs/Autocomplete.js +5 -44
- package/dist/components/MaterialUI/Inputs/AutocompleteProps.js +3 -37
- package/dist/components/MaterialUI/Inputs/Checkbox.js +3 -40
- package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +3 -43
- package/dist/components/MaterialUI/Inputs/CheckboxGroupProps.js +3 -38
- package/dist/components/MaterialUI/Inputs/CheckboxProps.js +3 -39
- package/dist/components/MaterialUI/Inputs/DatePicker.js +18 -57
- package/dist/components/MaterialUI/Inputs/InputBase.js +7 -56
- package/dist/components/MaterialUI/Inputs/InputBaseProps.js +3 -51
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +12 -65
- package/dist/components/MaterialUI/Inputs/PredefinedElements/TitledSelect.js +3 -31
- package/dist/components/MaterialUI/Inputs/Radio.js +8 -54
- package/dist/components/MaterialUI/Inputs/RadioProps.js +3 -41
- package/dist/components/MaterialUI/Inputs/Select.js +10 -72
- package/dist/components/MaterialUI/Inputs/SelectProps.js +3 -46
- package/dist/components/MaterialUI/Inputs/StandaloneRadio.js +3 -35
- package/dist/components/MaterialUI/Inputs/Switch.js +4 -38
- package/dist/components/MaterialUI/Inputs/SwitchProps.js +3 -40
- package/dist/components/MaterialUI/Inputs/TimePicker.js +14 -91
- package/dist/components/MaterialUI/Inputs/createInput.js +5 -30
- package/dist/components/MaterialUI/Inputs/index.js +0 -35
- package/dist/components/MaterialUI/Inputs/standaloneRadioProps.js +3 -41
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +12 -56
- package/dist/components/MaterialUI/Navigation/DropDownMenuProps.js +3 -33
- package/dist/components/MaterialUI/Navigation/ExternalLink.js +2 -27
- package/dist/components/MaterialUI/Navigation/PredefinedElements/ActionMenu.js +4 -31
- package/dist/components/MaterialUI/Navigation/TabBar.js +22 -103
- package/dist/components/MaterialUI/Navigation/TabLabel.js +7 -41
- package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +7 -42
- package/dist/components/MaterialUI/ScopeSelector/ScopeTreeView.js +22 -62
- package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +16 -68
- package/dist/components/MaterialUI/Surfaces/ExpansionPanel.js +15 -55
- package/dist/components/MaterialUI/Surfaces/Paper.js +1 -31
- package/dist/components/MaterialUI/Surfaces/PredefinedElements/TitledPaper.js +3 -28
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +19 -62
- package/dist/components/MaterialUI/Surfaces/expansionPanelProps.js +3 -55
- package/dist/components/MaterialUI/Surfaces/paperProps.js +3 -36
- package/dist/components/MaterialUI/componentProps.js +3 -29
- package/dist/components/MaterialUI/hocs/withDeferredPopper.js +10 -59
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +8 -44
- package/dist/components/MaterialUI/muiThemes.js +5 -57
- package/dist/components/MaterialUI/textProps.js +3 -33
- package/dist/components/Modal/Background.js +0 -19
- package/dist/components/Modal/Dialog.js +2 -26
- package/dist/components/Modal/Wrapper.js +0 -26
- package/dist/components/Modal/index.js +8 -44
- package/dist/components/Modules.js +21 -93
- package/dist/components/MultiSelector.js +21 -74
- package/dist/components/Navigation/Bar.js +29 -90
- package/dist/components/Navigation/Tab.js +22 -74
- package/dist/components/Navigation/index.js +2 -21
- package/dist/components/Navigation/useNavigationState.js +90 -173
- package/dist/components/Placeholder.js +5 -43
- package/dist/components/Provision.js +4 -36
- package/dist/components/Routing/FullPage.js +14 -37
- package/dist/components/Routing/Page.js +14 -51
- package/dist/components/Routing/Segment.js +5 -30
- package/dist/components/Routing/SegmentPage.js +26 -106
- package/dist/components/Routing/SubPage.js +22 -59
- package/dist/components/Routing/withWaypointing.js +5 -36
- package/dist/components/Scope/ScopeModificationConfirmationDialog.js +3 -30
- package/dist/components/Scope/ScopeNode.js +8 -49
- package/dist/components/Scope/Selector.js +8 -44
- package/dist/components/Scope/index.js +29 -96
- package/dist/components/Scope/useScopeConfirmationModalState.js +33 -100
- package/dist/components/Scope/useScopeData.js +0 -25
- package/dist/components/Scope/useScopeSelect.js +0 -26
- package/dist/components/Selector.js +15 -76
- package/dist/components/Sidepanel.js +0 -28
- package/dist/components/Spritesheet.js +0 -26
- package/dist/components/Switch.js +11 -51
- package/dist/components/Text.js +6 -50
- package/dist/components/ToastList.js +5 -45
- package/dist/components/Toolbar.js +16 -74
- package/dist/components/Tooltip.js +0 -24
- package/dist/components/Treeview/Branch.js +0 -25
- package/dist/components/Treeview/Label.js +0 -29
- package/dist/components/Treeview/Leaf.js +0 -21
- package/dist/components/Treeview/Node.js +17 -55
- package/dist/components/Treeview/index.js +25 -66
- package/dist/components/Treeview/settings.js +0 -17
- package/dist/constants.js +5 -18
- package/dist/content/iconsSheet.svg +22 -0
- package/dist/content/orckestra-logo-white.png +0 -0
- package/dist/getTheme.js +0 -29
- package/dist/getThemeOverrides.js +3 -22
- package/dist/hocs/routingConnector.js +0 -21
- package/dist/hocs/withAuthentication.js +4 -26
- package/dist/hocs/withClickOutside.js +2 -28
- package/dist/hocs/withErrorBoundary.js +2 -37
- package/dist/hocs/withId.js +1 -30
- package/dist/hocs/withInfiniteScroll.js +15 -32
- package/dist/hocs/withInitialLoad.js +0 -20
- package/dist/hocs/withLocaleSwitch.js +0 -19
- package/dist/hocs/withNavigationLink.js +5 -32
- package/dist/hocs/withRequestActivity.js +0 -21
- package/dist/hocs/withScopeData.js +6 -33
- package/dist/hocs/withScrollBox.js +2 -31
- package/dist/hocs/withToggle.js +9 -37
- package/dist/hocs/withUpdateHandler.js +3 -23
- package/dist/hocs/withViewState.js +5 -32
- package/dist/hooks/useDispatchWithModulesData.js +0 -26
- package/dist/hooks/useEditState.js +10 -105
- package/dist/hooks/useEntityLoader.js +18 -67
- package/dist/hooks/useFullEntityEditState.js +9 -56
- package/dist/hooks/useInfiniteScroll.js +5 -33
- package/dist/hooks/useLabelMessage.js +3 -42
- package/dist/hooks/useLoader.js +0 -27
- package/dist/hooks/useMultipleFieldEditState.js +3 -40
- package/dist/hooks/useNavigationHandler.js +3 -28
- package/dist/hooks/useNotificationRequestState.js +17 -47
- package/dist/hooks/usePreviousModified.js +0 -24
- package/dist/hooks/useRequestState.js +8 -38
- package/dist/hooks/useSelectorAndUnwrap.js +0 -23
- package/dist/hooks/useToggle.js +5 -35
- package/dist/hooks/useViewState.js +0 -23
- package/dist/index.js +1 -2
- package/dist/reducers/applications.js +0 -23
- package/dist/reducers/authentication.js +6 -37
- package/dist/reducers/countries.js +0 -25
- package/dist/reducers/localeFactory.js +0 -30
- package/dist/reducers/metadata.js +3 -63
- package/dist/reducers/modules.js +0 -36
- package/dist/reducers/navigation.js +8 -47
- package/dist/reducers/request.js +0 -28
- package/dist/reducers/requestStates.js +0 -42
- package/dist/reducers/scopes.js +0 -28
- package/dist/reducers/settings.js +4 -39
- package/dist/reducers/timezones.js +0 -25
- package/dist/reducers/toasts.js +0 -27
- package/dist/reducers/versionInfo.js +0 -24
- package/dist/reducers/view.js +36 -84
- package/dist/schemas/countries.js +0 -17
- package/dist/schemas/definitions.js +0 -17
- package/dist/schemas/metadata.js +0 -17
- package/dist/schemas/productDefinitions.js +0 -17
- package/dist/schemas/scopes.js +0 -17
- package/dist/schemas/timezones.js +0 -17
- package/dist/selectors/applications.js +0 -20
- package/dist/selectors/authentication.js +17 -41
- package/dist/selectors/countries.js +0 -22
- package/dist/selectors/locale.js +1 -29
- package/dist/selectors/metadata.js +4 -45
- package/dist/selectors/modules.js +3 -22
- package/dist/selectors/navigation.js +9 -39
- package/dist/selectors/requestStates.js +0 -22
- package/dist/selectors/requests.js +2 -22
- package/dist/selectors/route.js +0 -21
- package/dist/selectors/scope.js +0 -32
- package/dist/selectors/settings.js +0 -18
- package/dist/selectors/timezones.js +0 -19
- package/dist/selectors/versionInfo.js +0 -18
- package/dist/selectors/view.js +3 -74
- package/dist/sharedMessages.js +0 -17
- package/dist/spawnerMiddleware.js +0 -24
- package/dist/utils/buildUrl.js +7 -38
- package/dist/utils/countryHelper.js +0 -18
- package/dist/utils/curry.js +0 -19
- package/dist/utils/debounce.js +1 -20
- package/dist/utils/displayModeHelper.js +0 -24
- package/dist/utils/domHelper.js +0 -17
- package/dist/utils/flatten.js +7 -38
- package/dist/utils/index.js +0 -31
- package/dist/utils/insertIcons.js +0 -21
- package/dist/utils/localizationHelper.js +0 -26
- package/dist/utils/logPass.js +1 -22
- package/dist/utils/mapHelper.js +1 -25
- package/dist/utils/memoize.js +0 -23
- package/dist/utils/modelValidationHelper.js +3 -42
- package/dist/utils/normalizeForSearch.js +2 -19
- package/dist/utils/objectHelper.js +2 -24
- package/dist/utils/parseHelper.js +0 -32
- package/dist/utils/profilerHelper.js +0 -18
- package/dist/utils/propertyHelper.js +1 -38
- package/dist/utils/propertyValidator.js +0 -25
- package/dist/utils/requestProcessingHelper.js +0 -24
- package/dist/utils/safeGet.js +0 -18
- package/dist/utils/setTranslation.js +1 -28
- package/dist/utils/setTranslationWithFallback.js +1 -33
- package/dist/utils/stripKey.js +1 -23
- package/dist/utils/styledPropFuncs.js +3 -29
- package/dist/utils/testUtils.js +14 -91
- package/dist/utils/timezoneHelper.js +8 -46
- package/dist/utils/unwrapImmutable.js +0 -19
- package/dist/utils/urlHelper.js +3 -28
- package/dist/whyDidYouRerender.js +0 -5
- package/package.json +1 -1
- package/src/components/Routing/SubPage.js +17 -2
- package/src/components/Routing/SubPage.test.js +168 -1
- package/src/constants.js +2 -0
- package/src/content/iconsSheet.svg +22 -0
- package/src/content/orckestra-logo-white.png +0 -0
- package/src/hooks/useEditState.js +12 -2
- package/src/hooks/useEditState.test.js +1 -1
- package/src/selectors/authentication.js +13 -0
- package/src/selectors/authentication.test.js +322 -0
|
@@ -2,82 +2,59 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.useEditState = exports.useDynamicEditState = exports.default = void 0;
|
|
5
|
-
|
|
6
5
|
var _react = require("react");
|
|
7
|
-
|
|
8
6
|
var _reactRedux = require("react-redux");
|
|
9
|
-
|
|
10
7
|
var _navigation = require("./../selectors/navigation");
|
|
11
|
-
|
|
12
8
|
var _useDispatchWithModulesData = require("./../hooks/useDispatchWithModulesData");
|
|
13
|
-
|
|
14
9
|
var _view = require("./../actions/view");
|
|
15
|
-
|
|
16
10
|
var _modelValidationHelper = require("../utils/modelValidationHelper");
|
|
17
|
-
|
|
18
11
|
var _useSelectorAndUnwrap = require("./useSelectorAndUnwrap");
|
|
19
|
-
|
|
20
12
|
var _lodash = require("lodash");
|
|
21
|
-
|
|
22
13
|
var _mapHelper = require("../utils/mapHelper");
|
|
23
|
-
|
|
24
14
|
(function () {
|
|
25
15
|
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
26
16
|
enterModule && enterModule(module);
|
|
27
17
|
})();
|
|
28
|
-
|
|
29
18
|
(function () {
|
|
30
19
|
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
31
20
|
enterModule && enterModule(module);
|
|
32
21
|
})();
|
|
33
|
-
|
|
34
22
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
35
|
-
|
|
36
23
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
37
|
-
|
|
38
|
-
function
|
|
39
|
-
|
|
24
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
26
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
40
27
|
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
41
28
|
return a;
|
|
42
29
|
};
|
|
43
|
-
|
|
44
30
|
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
45
31
|
return a;
|
|
46
32
|
};
|
|
47
|
-
|
|
48
33
|
// if you need to override default validation rules just pass new rules with default keys
|
|
49
34
|
// as properties of extendedValidationRules
|
|
50
35
|
var useEditState = function useEditState(entityId, sectionName, extendedValidationRules) {
|
|
51
36
|
if (extendedValidationRules === void 0) {
|
|
52
37
|
extendedValidationRules = {};
|
|
53
38
|
}
|
|
54
|
-
|
|
55
39
|
var currentModuleName = (0, _reactRedux.useSelector)(_navigation.selectCurrentModuleName);
|
|
56
40
|
var dispatchWithModulesData = (0, _useDispatchWithModulesData.useDispatchWithModulesData)();
|
|
57
|
-
|
|
58
41
|
var mergedValidationRules = _objectSpread(_objectSpread({}, _modelValidationHelper.validationRules), extendedValidationRules);
|
|
59
|
-
|
|
60
42
|
var useFieldState = function useFieldState(keys, initialValue, errorTypes, saveInitialValueToEditState, preValidateInitialValue, fieldDependencies) {
|
|
61
43
|
if (initialValue === void 0) {
|
|
62
44
|
initialValue = "";
|
|
63
45
|
}
|
|
64
|
-
|
|
65
46
|
if (errorTypes === void 0) {
|
|
66
47
|
errorTypes = [];
|
|
67
48
|
}
|
|
68
|
-
|
|
69
49
|
if (saveInitialValueToEditState === void 0) {
|
|
70
50
|
saveInitialValueToEditState = false;
|
|
71
51
|
}
|
|
72
|
-
|
|
73
52
|
if (preValidateInitialValue === void 0) {
|
|
74
53
|
preValidateInitialValue = false;
|
|
75
54
|
}
|
|
76
|
-
|
|
77
55
|
if (fieldDependencies === void 0) {
|
|
78
56
|
fieldDependencies = {};
|
|
79
57
|
}
|
|
80
|
-
|
|
81
58
|
var stateValue = (0, _useSelectorAndUnwrap.useSelectorAndUnwrap)(function (state) {
|
|
82
59
|
return state.getIn(["view", "edit", currentModuleName, entityId, sectionName, "model"].concat(keys));
|
|
83
60
|
});
|
|
@@ -88,12 +65,10 @@ var useEditState = function useEditState(entityId, sectionName, extendedValidati
|
|
|
88
65
|
if (dependencies === void 0) {
|
|
89
66
|
dependencies = {};
|
|
90
67
|
}
|
|
91
|
-
|
|
92
68
|
var valueToValidate = value != null ? value : editState.value;
|
|
93
69
|
var hasAnyValidationErrors = false;
|
|
94
70
|
errorTypes.forEach(function (errorType) {
|
|
95
71
|
var isValid = mergedValidationRules[errorType](valueToValidate, _objectSpread(_objectSpread({}, fieldDependencies), dependencies));
|
|
96
|
-
|
|
97
72
|
if (isValid === false && hasAnyValidationErrors === false) {
|
|
98
73
|
dispatchWithModulesData(_view.setEditModelFieldError, [keys, errorType, entityId, sectionName]);
|
|
99
74
|
hasAnyValidationErrors = true;
|
|
@@ -104,22 +79,18 @@ var useEditState = function useEditState(entityId, sectionName, extendedValidati
|
|
|
104
79
|
(0, _react.useEffect)(function () {
|
|
105
80
|
if (saveInitialValueToEditState && stateValue == null) {
|
|
106
81
|
dispatchWithModulesData(_view.setEditModelField, [keys, initialValue, initialValue, entityId, sectionName]);
|
|
107
|
-
|
|
108
82
|
if (preValidateInitialValue) {
|
|
109
83
|
isEditStateValid(initialValue);
|
|
110
84
|
}
|
|
111
85
|
}
|
|
112
86
|
}, [initialValue, keys, saveInitialValueToEditState, preValidateInitialValue, stateValue, isEditStateValid]);
|
|
113
|
-
|
|
114
87
|
var updateEditState = function updateEditState(newValue, dependencies) {
|
|
115
88
|
dispatchWithModulesData(_view.setEditModelField, [keys, newValue, initialValue, entityId, sectionName]);
|
|
116
89
|
isEditStateValid(newValue, dependencies);
|
|
117
90
|
};
|
|
118
|
-
|
|
119
91
|
var resetEditState = function resetEditState() {
|
|
120
92
|
dispatchWithModulesData(_view.setEditModelField, [keys, initialValue, initialValue, entityId, sectionName]);
|
|
121
93
|
};
|
|
122
|
-
|
|
123
94
|
return {
|
|
124
95
|
state: editState,
|
|
125
96
|
update: updateEditState,
|
|
@@ -127,49 +98,38 @@ var useEditState = function useEditState(entityId, sectionName, extendedValidati
|
|
|
127
98
|
isValid: isEditStateValid
|
|
128
99
|
};
|
|
129
100
|
};
|
|
130
|
-
|
|
131
101
|
__signature__(useFieldState, "useSelectorAndUnwrap{stateValue}\nuseCallback{isEditStateValid}\nuseEffect{}", function () {
|
|
132
102
|
return [_useSelectorAndUnwrap.useSelectorAndUnwrap];
|
|
133
103
|
});
|
|
134
|
-
|
|
135
104
|
__signature__(useFieldState, "useSelectorAndUnwrap{stateValue}\nuseCallback{isEditStateValid}\nuseEffect{}", function () {
|
|
136
105
|
return [_useSelectorAndUnwrap.useSelectorAndUnwrap];
|
|
137
106
|
});
|
|
138
|
-
|
|
139
107
|
return useFieldState;
|
|
140
|
-
};
|
|
141
|
-
// as properties of extendedValidationRules
|
|
142
|
-
|
|
108
|
+
};
|
|
143
109
|
|
|
110
|
+
// if you need to override default validation rules just pass new rules with default keys
|
|
111
|
+
// as properties of extendedValidationRules
|
|
144
112
|
exports.useEditState = useEditState;
|
|
145
|
-
|
|
146
113
|
__signature__(useEditState, "useSelector{currentModuleName}\nuseDispatchWithModulesData{dispatchWithModulesData}", function () {
|
|
147
114
|
return [_reactRedux.useSelector, _useDispatchWithModulesData.useDispatchWithModulesData];
|
|
148
115
|
});
|
|
149
|
-
|
|
150
116
|
__signature__(useEditState, "useSelector{currentModuleName}\nuseDispatchWithModulesData{dispatchWithModulesData}", function () {
|
|
151
117
|
return [_reactRedux.useSelector, _useDispatchWithModulesData.useDispatchWithModulesData];
|
|
152
118
|
});
|
|
153
|
-
|
|
154
119
|
var useDynamicEditState = function useDynamicEditState(entityId, sectionName, extendedValidationRules) {
|
|
155
120
|
if (extendedValidationRules === void 0) {
|
|
156
121
|
extendedValidationRules = {};
|
|
157
122
|
}
|
|
158
|
-
|
|
159
123
|
var currentModuleName = (0, _reactRedux.useSelector)(_navigation.selectCurrentModuleName);
|
|
160
124
|
var dispatchWithModulesData = (0, _useDispatchWithModulesData.useDispatchWithModulesData)();
|
|
161
|
-
|
|
162
125
|
var mergedValidationRules = _objectSpread(_objectSpread({}, _modelValidationHelper.validationRules), extendedValidationRules);
|
|
163
|
-
|
|
164
126
|
var useFieldState = function useFieldState(keys, initialValue, saveInitialValueToEditState) {
|
|
165
127
|
if (initialValue === void 0) {
|
|
166
128
|
initialValue = "";
|
|
167
129
|
}
|
|
168
|
-
|
|
169
130
|
if (saveInitialValueToEditState === void 0) {
|
|
170
131
|
saveInitialValueToEditState = false;
|
|
171
132
|
}
|
|
172
|
-
|
|
173
133
|
var stateValue = (0, _useSelectorAndUnwrap.useSelectorAndUnwrap)(function (state) {
|
|
174
134
|
return state.getIn(["view", "edit", currentModuleName, entityId, sectionName, "model"].concat(keys));
|
|
175
135
|
});
|
|
@@ -178,54 +138,41 @@ var useDynamicEditState = function useDynamicEditState(entityId, sectionName, ex
|
|
|
178
138
|
dispatchWithModulesData(_view.setEditModelField, [keys, initialValue, initialValue, entityId, sectionName]);
|
|
179
139
|
}
|
|
180
140
|
}, [initialValue, keys, saveInitialValueToEditState, stateValue]);
|
|
181
|
-
|
|
182
141
|
var getEditStateValue = function getEditStateValue(path) {
|
|
183
142
|
var _stateValue$value;
|
|
184
|
-
|
|
185
143
|
if (path === void 0) {
|
|
186
144
|
path = [];
|
|
187
145
|
}
|
|
188
|
-
|
|
189
146
|
var keyPath = path.join(".");
|
|
190
147
|
var value = (_stateValue$value = stateValue == null ? void 0 : stateValue.value) != null ? _stateValue$value : initialValue;
|
|
191
148
|
var resultValue = (0, _mapHelper.mapModifiedData)(value);
|
|
192
149
|
var result = !path.length ? resultValue : (0, _lodash.get)(resultValue, keyPath, resultValue);
|
|
193
150
|
return result;
|
|
194
151
|
};
|
|
195
|
-
|
|
196
152
|
var getValidPath = function getValidPath(path) {
|
|
197
153
|
var _stateValue$value2;
|
|
198
|
-
|
|
199
154
|
var result = [];
|
|
200
155
|
var value = (_stateValue$value2 = stateValue == null ? void 0 : stateValue.value) != null ? _stateValue$value2 : initialValue;
|
|
201
|
-
|
|
202
156
|
var checkPath = function checkPath(obj) {
|
|
203
157
|
if ((0, _lodash.has)(obj, "value")) {
|
|
204
158
|
result.push("value");
|
|
205
159
|
return obj.value;
|
|
206
160
|
}
|
|
207
|
-
|
|
208
161
|
return obj;
|
|
209
162
|
};
|
|
210
|
-
|
|
211
163
|
var valueItem = (0, _lodash.cloneDeep)(value);
|
|
212
|
-
|
|
213
164
|
for (var i = 0; i < path.length; i++) {
|
|
214
165
|
result.push(path[i]);
|
|
215
|
-
|
|
216
166
|
if (i !== path.length - 1) {
|
|
217
167
|
valueItem = checkPath(valueItem[path[i]]);
|
|
218
168
|
}
|
|
219
169
|
}
|
|
220
|
-
|
|
221
170
|
return result;
|
|
222
171
|
};
|
|
223
|
-
|
|
224
172
|
var hasAnyValidationErrors = function hasAnyValidationErrors(value, path, errorTypes, dependencies) {
|
|
225
173
|
for (var i = 0; i < errorTypes.length; i++) {
|
|
226
174
|
var errorType = errorTypes[i];
|
|
227
175
|
var isValid = mergedValidationRules[errorType](value, dependencies);
|
|
228
|
-
|
|
229
176
|
if (isValid === false) {
|
|
230
177
|
dispatchWithModulesData(_view.setEditModelFieldError, [path, errorType, entityId, sectionName]);
|
|
231
178
|
return true;
|
|
@@ -233,95 +180,75 @@ var useDynamicEditState = function useDynamicEditState(entityId, sectionName, ex
|
|
|
233
180
|
dispatchWithModulesData(_view.removeEditModelFieldError, [path, entityId, sectionName]);
|
|
234
181
|
}
|
|
235
182
|
}
|
|
236
|
-
|
|
237
183
|
return false;
|
|
238
184
|
};
|
|
239
|
-
|
|
240
185
|
var updateEditState = function updateEditState(newValue, path, errorTypes, dependencies) {
|
|
241
186
|
if (path === void 0) {
|
|
242
187
|
path = [];
|
|
243
188
|
}
|
|
244
|
-
|
|
245
189
|
if (errorTypes === void 0) {
|
|
246
190
|
errorTypes = [];
|
|
247
191
|
}
|
|
248
|
-
|
|
249
192
|
if (dependencies === void 0) {
|
|
250
193
|
dependencies = {};
|
|
251
194
|
}
|
|
252
|
-
|
|
253
195
|
var pathToField = getValidPath(path);
|
|
254
196
|
var fullPath = !path.length ? [].concat(keys) : [].concat(keys, ["value"], pathToField);
|
|
255
197
|
var initialFieldValue = !path.length ? initialValue : (0, _lodash.get)(initialValue, pathToField);
|
|
256
198
|
dispatchWithModulesData(_view.setEditModelField, [fullPath, newValue, initialFieldValue, entityId, sectionName]);
|
|
257
199
|
hasAnyValidationErrors(newValue, fullPath, errorTypes, dependencies);
|
|
258
200
|
};
|
|
259
|
-
|
|
260
201
|
var deleteEditState = function deleteEditState(path) {
|
|
261
202
|
if (path === void 0) {
|
|
262
203
|
path = [];
|
|
263
204
|
}
|
|
264
|
-
|
|
265
205
|
var fullPath = !path.length ? [].concat(keys) : [].concat(keys, ["value"], getValidPath(path));
|
|
266
|
-
|
|
267
206
|
if (path.length === 0) {
|
|
268
207
|
dispatchWithModulesData(_view.removeEditModel, [fullPath, entityId, sectionName]);
|
|
269
208
|
return;
|
|
270
209
|
}
|
|
271
|
-
|
|
272
210
|
if (path.length > 1) {
|
|
273
211
|
path.pop();
|
|
274
212
|
var keyPath = path.join(".");
|
|
275
213
|
return dispatchWithModulesData(_view.removeEditModelField, [fullPath, (0, _lodash.get)(initialValue, keyPath), entityId, sectionName]);
|
|
276
214
|
}
|
|
277
|
-
|
|
278
215
|
dispatchWithModulesData(_view.removeEditModelField, [fullPath, initialValue, entityId, sectionName]);
|
|
279
216
|
};
|
|
280
|
-
|
|
281
217
|
var resetEditState = function resetEditState(path) {
|
|
282
218
|
if (path === void 0) {
|
|
283
219
|
path = [];
|
|
284
220
|
}
|
|
285
|
-
|
|
286
|
-
var fullPath = !path.length ? [].concat(keys) : [].concat(keys, ["value"],
|
|
287
|
-
|
|
221
|
+
var pathToField = getValidPath(path);
|
|
222
|
+
var fullPath = !path.length ? [].concat(keys) : [].concat(keys, ["value"], pathToField);
|
|
223
|
+
var initialFieldValue = !path.length ? initialValue : (0, _lodash.get)(initialValue, pathToField);
|
|
224
|
+
dispatchWithModulesData(_view.setEditModelField, [fullPath, initialFieldValue, initialFieldValue, entityId, sectionName]);
|
|
288
225
|
};
|
|
289
|
-
|
|
290
226
|
var isEditStateValid = function isEditStateValid(value, path, errorTypes, dependencies) {
|
|
291
227
|
var _stateValue$value3;
|
|
292
|
-
|
|
293
228
|
if (path === void 0) {
|
|
294
229
|
path = [];
|
|
295
230
|
}
|
|
296
|
-
|
|
297
231
|
if (errorTypes === void 0) {
|
|
298
232
|
errorTypes = [];
|
|
299
233
|
}
|
|
300
|
-
|
|
301
234
|
if (dependencies === void 0) {
|
|
302
235
|
dependencies = {};
|
|
303
236
|
}
|
|
304
|
-
|
|
305
237
|
var pathToField = getValidPath(path);
|
|
306
238
|
var fullValue = value != null ? value : (0, _lodash.get)((_stateValue$value3 = stateValue == null ? void 0 : stateValue.value) != null ? _stateValue$value3 : initialValue, pathToField);
|
|
307
239
|
var fullPath = !path.length ? [].concat(keys) : [].concat(keys, ["value"], pathToField);
|
|
308
|
-
|
|
309
240
|
if (fullValue != null && (typeof fullValue !== "object" || Array.isArray(fullValue))) {
|
|
310
241
|
dispatchWithModulesData(_view.setEditModelField, [fullPath, fullValue, fullValue, entityId, sectionName]);
|
|
311
242
|
}
|
|
312
|
-
|
|
313
243
|
var valueToValidate = value != null ? value : getEditStateValue(path);
|
|
314
244
|
var hasValidationErrors = hasAnyValidationErrors(valueToValidate, fullPath, errorTypes, dependencies);
|
|
315
245
|
return !hasValidationErrors;
|
|
316
246
|
};
|
|
317
|
-
|
|
318
247
|
var getError = function getError(path) {
|
|
319
248
|
var _stateValue$value4;
|
|
320
|
-
|
|
321
249
|
if (path === void 0) {
|
|
322
250
|
path = [];
|
|
323
251
|
}
|
|
324
|
-
|
|
325
252
|
var validPath = getValidPath(path);
|
|
326
253
|
var keyPath = validPath.join(".");
|
|
327
254
|
if (!path.length && (0, _lodash.has)(stateValue, "error")) return stateValue.error;
|
|
@@ -329,19 +256,15 @@ var useDynamicEditState = function useDynamicEditState(entityId, sectionName, ex
|
|
|
329
256
|
var result = !path.length ? value : (0, _lodash.get)(value, keyPath);
|
|
330
257
|
return result == null ? void 0 : result.error;
|
|
331
258
|
};
|
|
332
|
-
|
|
333
259
|
var getEditState = function getEditState(path) {
|
|
334
260
|
var _stateValue$value5;
|
|
335
|
-
|
|
336
261
|
if (path === void 0) {
|
|
337
262
|
path = [];
|
|
338
263
|
}
|
|
339
|
-
|
|
340
264
|
var keyPath = path.join(".");
|
|
341
265
|
var value = (_stateValue$value5 = stateValue == null ? void 0 : stateValue.value) != null ? _stateValue$value5 : initialValue;
|
|
342
266
|
return !path.length ? value : (0, _lodash.get)(value, keyPath);
|
|
343
267
|
};
|
|
344
|
-
|
|
345
268
|
return {
|
|
346
269
|
getStateValue: getEditStateValue,
|
|
347
270
|
update: updateEditState,
|
|
@@ -352,69 +275,51 @@ var useDynamicEditState = function useDynamicEditState(entityId, sectionName, ex
|
|
|
352
275
|
getState: getEditState
|
|
353
276
|
};
|
|
354
277
|
};
|
|
355
|
-
|
|
356
278
|
__signature__(useFieldState, "useSelectorAndUnwrap{stateValue}\nuseEffect{}", function () {
|
|
357
279
|
return [_useSelectorAndUnwrap.useSelectorAndUnwrap];
|
|
358
280
|
});
|
|
359
|
-
|
|
360
281
|
__signature__(useFieldState, "useSelectorAndUnwrap{stateValue}\nuseEffect{}", function () {
|
|
361
282
|
return [_useSelectorAndUnwrap.useSelectorAndUnwrap];
|
|
362
283
|
});
|
|
363
|
-
|
|
364
284
|
return useFieldState;
|
|
365
285
|
};
|
|
366
|
-
|
|
367
286
|
exports.useDynamicEditState = useDynamicEditState;
|
|
368
|
-
|
|
369
287
|
__signature__(useDynamicEditState, "useSelector{currentModuleName}\nuseDispatchWithModulesData{dispatchWithModulesData}", function () {
|
|
370
288
|
return [_reactRedux.useSelector, _useDispatchWithModulesData.useDispatchWithModulesData];
|
|
371
289
|
});
|
|
372
|
-
|
|
373
290
|
__signature__(useDynamicEditState, "useSelector{currentModuleName}\nuseDispatchWithModulesData{dispatchWithModulesData}", function () {
|
|
374
291
|
return [_reactRedux.useSelector, _useDispatchWithModulesData.useDispatchWithModulesData];
|
|
375
292
|
});
|
|
376
|
-
|
|
377
293
|
var _default = useEditState;
|
|
378
294
|
var _default2 = _default;
|
|
379
295
|
var _default3 = _default2;
|
|
380
296
|
exports.default = _default3;
|
|
381
297
|
;
|
|
382
|
-
|
|
383
298
|
(function () {
|
|
384
299
|
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
385
|
-
|
|
386
300
|
if (!reactHotLoader) {
|
|
387
301
|
return;
|
|
388
302
|
}
|
|
389
|
-
|
|
390
303
|
reactHotLoader.register(useEditState, "useEditState", "/home/vsts/work/1/s/src/hooks/useEditState.js");
|
|
391
304
|
reactHotLoader.register(useDynamicEditState, "useDynamicEditState", "/home/vsts/work/1/s/src/hooks/useEditState.js");
|
|
392
305
|
reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/hooks/useEditState.js");
|
|
393
306
|
})();
|
|
394
|
-
|
|
395
307
|
;
|
|
396
|
-
|
|
397
308
|
(function () {
|
|
398
309
|
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
399
310
|
leaveModule && leaveModule(module);
|
|
400
311
|
})();
|
|
401
|
-
|
|
402
312
|
;
|
|
403
|
-
|
|
404
313
|
(function () {
|
|
405
314
|
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
406
|
-
|
|
407
315
|
if (!reactHotLoader) {
|
|
408
316
|
return;
|
|
409
317
|
}
|
|
410
|
-
|
|
411
318
|
reactHotLoader.register(useEditState, "useEditState", "/home/vsts/work/1/s/src/hooks/useEditState.js");
|
|
412
319
|
reactHotLoader.register(useDynamicEditState, "useDynamicEditState", "/home/vsts/work/1/s/src/hooks/useEditState.js");
|
|
413
320
|
reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/hooks/useEditState.js");
|
|
414
321
|
})();
|
|
415
|
-
|
|
416
322
|
;
|
|
417
|
-
|
|
418
323
|
(function () {
|
|
419
324
|
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
420
325
|
leaveModule && leaveModule(module);
|
|
@@ -2,102 +2,71 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
|
-
|
|
6
5
|
var _useLoader = _interopRequireDefault(require("./useLoader"));
|
|
7
|
-
|
|
8
6
|
var _useRequestState3 = _interopRequireDefault(require("./useRequestState"));
|
|
9
|
-
|
|
10
7
|
var _constants = require("../constants");
|
|
11
|
-
|
|
12
8
|
var _react = require("react");
|
|
13
|
-
|
|
14
9
|
var _navigation = require("../selectors/navigation");
|
|
15
|
-
|
|
16
10
|
var _useSelectorAndUnwrap = require("./useSelectorAndUnwrap");
|
|
17
|
-
|
|
18
11
|
var _reactRedux = require("react-redux");
|
|
19
|
-
|
|
20
12
|
var _reduxApiMiddleware = require("redux-api-middleware");
|
|
21
|
-
|
|
22
13
|
var _makeApiAction = require("../actions/makeApiAction");
|
|
23
|
-
|
|
24
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
15
|
(function () {
|
|
27
16
|
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
28
17
|
enterModule && enterModule(module);
|
|
29
18
|
})();
|
|
30
|
-
|
|
31
19
|
(function () {
|
|
32
20
|
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
33
21
|
enterModule && enterModule(module);
|
|
34
22
|
})();
|
|
35
|
-
|
|
36
23
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
37
|
-
|
|
38
24
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
|
|
25
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
26
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
27
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
42
28
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
43
|
-
|
|
44
29
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
45
|
-
|
|
46
30
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
47
|
-
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
51
|
-
|
|
31
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
32
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
52
33
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
53
|
-
|
|
54
34
|
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
55
35
|
return a;
|
|
56
36
|
};
|
|
57
|
-
|
|
58
37
|
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
59
38
|
return a;
|
|
60
39
|
};
|
|
61
|
-
|
|
62
40
|
var useEntityLoader = function useEntityLoader(entityId, loadAction, cutoutSelector) {
|
|
63
41
|
var _loadAction$RSAA$endp, _loadAction$RSAA;
|
|
64
|
-
|
|
65
42
|
if (Array.isArray(loadAction)) {
|
|
66
43
|
throw new Error("useEntityLoader does not support an array of actions");
|
|
67
44
|
}
|
|
68
|
-
|
|
69
45
|
var _useState = (0, _react.useState)(false),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
loadErrorUnhandled = _useState2[0],
|
|
48
|
+
setLoadErrorUnhandled = _useState2[1];
|
|
74
49
|
var moduleName = (0, _useSelectorAndUnwrap.useSelectorAndUnwrap)(_navigation.selectCurrentModuleName);
|
|
75
50
|
var closingTabHandlerAction = (0, _reactRedux.useSelector)((0, _navigation.selectClosingTabHandlerActionForEntity)(moduleName, entityId));
|
|
76
|
-
|
|
77
51
|
var _useRequestState = (0, _useRequestState3.default)({
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
52
|
+
keys: [(_loadAction$RSAA$endp = (_loadAction$RSAA = loadAction[_reduxApiMiddleware.RSAA]) == null ? void 0 : _loadAction$RSAA.endpoint) != null ? _loadAction$RSAA$endp : "invalidEndPoint"],
|
|
53
|
+
operation: _constants.requestStateOperations.fetch,
|
|
54
|
+
errorAction: function errorAction(errorResponse) {
|
|
55
|
+
setLoadErrorUnhandled(true);
|
|
56
|
+
if (errorResponse.status === 404 && closingTabHandlerAction) {
|
|
57
|
+
closingTabHandlerAction();
|
|
58
|
+
}
|
|
85
59
|
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
requestState = _useRequestState2[0];
|
|
90
|
-
|
|
60
|
+
}),
|
|
61
|
+
_useRequestState2 = _slicedToArray(_useRequestState, 1),
|
|
62
|
+
requestState = _useRequestState2[0];
|
|
91
63
|
var metaRequestState = requestState();
|
|
92
64
|
var cutout = !!(0, _reactRedux.useSelector)(cutoutSelector, _reactRedux.shallowEqual) || loadErrorUnhandled;
|
|
93
|
-
|
|
94
65
|
if (!loadAction[_reduxApiMiddleware.RSAA] && !cutout) {
|
|
95
66
|
throw new Error("useEntityLoader only supports RSAA api actions");
|
|
96
67
|
}
|
|
97
|
-
|
|
98
68
|
if (loadAction[_reduxApiMiddleware.RSAA]) {
|
|
99
69
|
var _loadAction$RSAA$type;
|
|
100
|
-
|
|
101
70
|
loadAction[_reduxApiMiddleware.RSAA].types = ((_loadAction$RSAA$type = loadAction[_reduxApiMiddleware.RSAA].types) != null ? _loadAction$RSAA$type : []).map(function (x) {
|
|
102
71
|
if (typeof x === "string") {
|
|
103
72
|
var actionType = x.endsWith("_FAILURE") ? (0, _makeApiAction.makeFailureActionType)(x) : {
|
|
@@ -110,72 +79,54 @@ var useEntityLoader = function useEntityLoader(entityId, loadAction, cutoutSelec
|
|
|
110
79
|
});
|
|
111
80
|
} else if (typeof x === "object") {
|
|
112
81
|
var _x$meta;
|
|
113
|
-
|
|
114
82
|
var _actionType = x.type.endsWith("_FAILURE") ? (0, _makeApiAction.makeFailureActionType)(x.type) : {};
|
|
115
|
-
|
|
116
83
|
return _objectSpread(_objectSpread(_objectSpread({}, x), _actionType), {}, {
|
|
117
84
|
meta: _objectSpread(_objectSpread({}, (_x$meta = x.meta) != null ? _x$meta : {}), {}, {
|
|
118
85
|
requestState: _objectSpread({}, metaRequestState)
|
|
119
86
|
})
|
|
120
87
|
});
|
|
121
88
|
}
|
|
122
|
-
|
|
123
89
|
throw new Error("useEntityLoader only supports RSAA api actions with valid types");
|
|
124
90
|
});
|
|
125
91
|
}
|
|
126
|
-
|
|
127
92
|
(0, _useLoader.default)(loadAction, function () {
|
|
128
93
|
return cutout;
|
|
129
94
|
});
|
|
130
95
|
};
|
|
131
|
-
|
|
132
96
|
__signature__(useEntityLoader, "useState{[loadErrorUnhandled, setLoadErrorUnhandled](false)}\nuseSelectorAndUnwrap{moduleName}\nuseSelector{closingTabHandlerAction}\nuseRequestState{[requestState]}\nuseSelector{}\nuseLoader{}", function () {
|
|
133
97
|
return [_useSelectorAndUnwrap.useSelectorAndUnwrap, _reactRedux.useSelector, _useRequestState3.default, _reactRedux.useSelector, _useLoader.default];
|
|
134
98
|
});
|
|
135
|
-
|
|
136
99
|
__signature__(useEntityLoader, "useState{[loadErrorUnhandled, setLoadErrorUnhandled](false)}\nuseSelectorAndUnwrap{moduleName}\nuseSelector{closingTabHandlerAction}\nuseRequestState{[requestState]}\nuseSelector{}\nuseLoader{}", function () {
|
|
137
100
|
return [_useSelectorAndUnwrap.useSelectorAndUnwrap, _reactRedux.useSelector, _useRequestState3.default, _reactRedux.useSelector, _useLoader.default];
|
|
138
101
|
});
|
|
139
|
-
|
|
140
102
|
var _default = useEntityLoader;
|
|
141
103
|
var _default2 = _default;
|
|
142
104
|
var _default3 = _default2;
|
|
143
105
|
exports.default = _default3;
|
|
144
106
|
;
|
|
145
|
-
|
|
146
107
|
(function () {
|
|
147
108
|
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
148
|
-
|
|
149
109
|
if (!reactHotLoader) {
|
|
150
110
|
return;
|
|
151
111
|
}
|
|
152
|
-
|
|
153
112
|
reactHotLoader.register(useEntityLoader, "useEntityLoader", "/home/vsts/work/1/s/src/hooks/useEntityLoader.js");
|
|
154
113
|
reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/hooks/useEntityLoader.js");
|
|
155
114
|
})();
|
|
156
|
-
|
|
157
115
|
;
|
|
158
|
-
|
|
159
116
|
(function () {
|
|
160
117
|
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
161
118
|
leaveModule && leaveModule(module);
|
|
162
119
|
})();
|
|
163
|
-
|
|
164
120
|
;
|
|
165
|
-
|
|
166
121
|
(function () {
|
|
167
122
|
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
168
|
-
|
|
169
123
|
if (!reactHotLoader) {
|
|
170
124
|
return;
|
|
171
125
|
}
|
|
172
|
-
|
|
173
126
|
reactHotLoader.register(useEntityLoader, "useEntityLoader", "/home/vsts/work/1/s/src/hooks/useEntityLoader.js");
|
|
174
127
|
reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/hooks/useEntityLoader.js");
|
|
175
128
|
})();
|
|
176
|
-
|
|
177
129
|
;
|
|
178
|
-
|
|
179
130
|
(function () {
|
|
180
131
|
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
181
132
|
leaveModule && leaveModule(module);
|