@reltio/components 1.4.1519 → 1.4.1520

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.
@@ -58,6 +58,7 @@ var useSearchNavigation = function () {
58
58
  var globalSearchRequestOptions = (0, react_redux_1.useSelector)(function (state) {
59
59
  return mdm_module_1.default.selectors.getGlobalSearchRequestOptions(state, ['ovOnly']);
60
60
  });
61
+ var updateEntitiesNavigationLoadingState = (0, contexts_1.useEntityLoadingIndication)().updateEntitiesNavigationLoadingState;
61
62
  var viewId = (0, react_1.useContext)(contexts_1.ViewIdContext);
62
63
  var dispatch = (0, react_redux_1.useDispatch)();
63
64
  var _c = (0, react_1.useState)(false), loading = _c[0], setLoading = _c[1];
@@ -249,6 +250,12 @@ var useSearchNavigation = function () {
249
250
  stepForwardWithCheck(cache, cacheIndex, total, index);
250
251
  }
251
252
  }, [stepForwardWithCheck, cache, uri, total, index]);
253
+ (0, react_1.useEffect)(function () {
254
+ updateEntitiesNavigationLoadingState(loading);
255
+ }, [updateEntitiesNavigationLoadingState, loading]);
256
+ (0, react_1.useEffect)(function () {
257
+ return function () { return updateEntitiesNavigationLoadingState(false); };
258
+ }, []);
252
259
  var isPrevDisabled = loading || index <= 0;
253
260
  var isNextDisabled = loading || index >= total - 1;
254
261
  return { total: total, onPrev: onPrev, onNext: onNext, onSearchResultsClick: onSearchResultsClick, isPrevDisabled: isPrevDisabled, isNextDisabled: isNextDisabled };
@@ -1,2 +1,13 @@
1
1
  import React from 'react';
2
- export declare const EntityLoadingIndicationContext: React.Context<(value: boolean) => void>;
2
+ declare type ContextValue = {
3
+ isLoading: boolean;
4
+ updateEntityLoadingState: (loading: boolean) => void;
5
+ updateEntitiesNavigationLoadingState: (loading: boolean) => void;
6
+ resetLoadingState: () => void;
7
+ };
8
+ declare type Props = {
9
+ children: React.ReactNode;
10
+ };
11
+ export declare const EntityLoadingIndicationProvider: ({ children }: Props) => JSX.Element;
12
+ export declare const useEntityLoadingIndication: () => ContextValue;
13
+ export {};
@@ -1,10 +1,70 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
4
35
  };
5
36
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.EntityLoadingIndicationContext = void 0;
7
- var react_1 = __importDefault(require("react"));
37
+ exports.useEntityLoadingIndication = exports.EntityLoadingIndicationProvider = void 0;
38
+ var react_1 = __importStar(require("react"));
8
39
  var utils_1 = require("../../core/utils");
9
- exports.EntityLoadingIndicationContext = react_1.default.createContext(utils_1.noop);
10
- exports.EntityLoadingIndicationContext.displayName = 'EntityLoadingIndicationContext';
40
+ var EntityLoadingIndicationContext = react_1.default.createContext({
41
+ isLoading: false,
42
+ updateEntityLoadingState: utils_1.noop,
43
+ updateEntitiesNavigationLoadingState: utils_1.noop,
44
+ resetLoadingState: utils_1.noop
45
+ });
46
+ var defaultLoadingState = { entitiesNavigation: false, entity: false };
47
+ var useEntityLoadingIndicationHook = function () {
48
+ var _a = (0, react_1.useState)(defaultLoadingState), loadingState = _a[0], setLoadingState = _a[1];
49
+ var updateEntityLoadingState = (0, react_1.useCallback)(function (loading) {
50
+ setLoadingState(function (prevLoadingState) { return (__assign(__assign({}, prevLoadingState), { entity: loading })); });
51
+ }, []);
52
+ var updateEntitiesNavigationLoadingState = (0, react_1.useCallback)(function (loading) {
53
+ setLoadingState(function (prevLoadingState) { return (__assign(__assign({}, prevLoadingState), { entitiesNavigation: loading })); });
54
+ }, []);
55
+ var resetLoadingState = (0, react_1.useCallback)(function () {
56
+ setLoadingState(defaultLoadingState);
57
+ }, []);
58
+ var isLoading = Object.values(loadingState).includes(true);
59
+ return { isLoading: isLoading, updateEntityLoadingState: updateEntityLoadingState, updateEntitiesNavigationLoadingState: updateEntitiesNavigationLoadingState, resetLoadingState: resetLoadingState };
60
+ };
61
+ var EntityLoadingIndicationProvider = function (_a) {
62
+ var children = _a.children;
63
+ var value = useEntityLoadingIndicationHook();
64
+ return react_1.default.createElement(EntityLoadingIndicationContext.Provider, { value: value }, children);
65
+ };
66
+ exports.EntityLoadingIndicationProvider = EntityLoadingIndicationProvider;
67
+ var useEntityLoadingIndication = function () {
68
+ return (0, react_1.useContext)(EntityLoadingIndicationContext);
69
+ };
70
+ exports.useEntityLoadingIndication = useEntityLoadingIndication;
@@ -1,2 +1,2 @@
1
- export const ViewIdContext: React.Context<any>;
2
- import React from "react";
1
+ import React from 'react';
2
+ export declare const ViewIdContext: React.Context<string>;
@@ -12,7 +12,7 @@ export { EntitiesMapContext } from './EntitiesMapContext';
12
12
  export { CrosswalksDisplayProvider, useCrosswalkColor, useCrosswalkFocus, useCrosswalkHighlight, useHighlightedCrosswalks } from './CrosswalksDisplayContext';
13
13
  export { ExpandedAttributesProvider, useAttributeExpanded } from './ExpandedAttributesContext';
14
14
  export { EntityMarkerContext } from './EntityMarkerContext';
15
- export { EntityLoadingIndicationContext } from './EntityLoadingIndicationContext';
15
+ export { EntityLoadingIndicationProvider, useEntityLoadingIndication } from './EntityLoadingIndicationContext';
16
16
  export { WorkflowTasksContext } from './WorkflowTasksContext';
17
17
  export { RelatedObjectUrisContext } from './RelatedObjectUrisContext';
18
18
  export { EntityContext } from './EntityContext';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useActionsHook = exports.ActionsHookProvider = exports.PageRequestsAbortingContext = exports.DependentLookupAutopopulationContext = exports.FeaturesContext = exports.LabelsContext = exports.UrlGeneratorsContext = exports.isHighlightedAttributeType = exports.isHighlightedErrorType = exports.ScrollType = exports.ScrollToElementProvider = exports.ScrollToElementContext = exports.SearchValueContext = exports.InterceptHandlersContext = exports.HighlightedValuesContext = exports.SnackbarContext = exports.SearchFiltersContext = exports.useReloadFacet = exports.ReloadFacetProvider = exports.useReloadAllFacets = exports.SandboxAPIContext = exports.EntityContext = exports.RelatedObjectUrisContext = exports.WorkflowTasksContext = exports.EntityLoadingIndicationContext = exports.EntityMarkerContext = exports.useAttributeExpanded = exports.ExpandedAttributesProvider = exports.useHighlightedCrosswalks = exports.useCrosswalkHighlight = exports.useCrosswalkFocus = exports.useCrosswalkColor = exports.CrosswalksDisplayProvider = exports.EntitiesMapContext = exports.IdContext = exports.ProfilePerspectiveViewContext = exports.PivotingAttributeContext = exports.UsersContext = exports.CollaborationContextProvider = exports.CollaborationContext = exports.BlockImageGalleryDialogContext = exports.ViewIdContext = exports.PopupBoundariesContext = exports.HistoryDiffContext = exports.AsyncMountContext = void 0;
3
+ exports.useActionsHook = exports.ActionsHookProvider = exports.PageRequestsAbortingContext = exports.DependentLookupAutopopulationContext = exports.FeaturesContext = exports.LabelsContext = exports.UrlGeneratorsContext = exports.isHighlightedAttributeType = exports.isHighlightedErrorType = exports.ScrollType = exports.ScrollToElementProvider = exports.ScrollToElementContext = exports.SearchValueContext = exports.InterceptHandlersContext = exports.HighlightedValuesContext = exports.SnackbarContext = exports.SearchFiltersContext = exports.useReloadFacet = exports.ReloadFacetProvider = exports.useReloadAllFacets = exports.SandboxAPIContext = exports.EntityContext = exports.RelatedObjectUrisContext = exports.WorkflowTasksContext = exports.useEntityLoadingIndication = exports.EntityLoadingIndicationProvider = exports.EntityMarkerContext = exports.useAttributeExpanded = exports.ExpandedAttributesProvider = exports.useHighlightedCrosswalks = exports.useCrosswalkHighlight = exports.useCrosswalkFocus = exports.useCrosswalkColor = exports.CrosswalksDisplayProvider = exports.EntitiesMapContext = exports.IdContext = exports.ProfilePerspectiveViewContext = exports.PivotingAttributeContext = exports.UsersContext = exports.CollaborationContextProvider = exports.CollaborationContext = exports.BlockImageGalleryDialogContext = exports.ViewIdContext = exports.PopupBoundariesContext = exports.HistoryDiffContext = exports.AsyncMountContext = void 0;
4
4
  var AsyncMountContext_1 = require("./AsyncMountContext");
5
5
  Object.defineProperty(exports, "AsyncMountContext", { enumerable: true, get: function () { return AsyncMountContext_1.AsyncMountContext; } });
6
6
  var HistoryAppearanceContext_1 = require("./HistoryAppearanceContext");
@@ -36,7 +36,8 @@ Object.defineProperty(exports, "useAttributeExpanded", { enumerable: true, get:
36
36
  var EntityMarkerContext_1 = require("./EntityMarkerContext");
37
37
  Object.defineProperty(exports, "EntityMarkerContext", { enumerable: true, get: function () { return EntityMarkerContext_1.EntityMarkerContext; } });
38
38
  var EntityLoadingIndicationContext_1 = require("./EntityLoadingIndicationContext");
39
- Object.defineProperty(exports, "EntityLoadingIndicationContext", { enumerable: true, get: function () { return EntityLoadingIndicationContext_1.EntityLoadingIndicationContext; } });
39
+ Object.defineProperty(exports, "EntityLoadingIndicationProvider", { enumerable: true, get: function () { return EntityLoadingIndicationContext_1.EntityLoadingIndicationProvider; } });
40
+ Object.defineProperty(exports, "useEntityLoadingIndication", { enumerable: true, get: function () { return EntityLoadingIndicationContext_1.useEntityLoadingIndication; } });
40
41
  var WorkflowTasksContext_1 = require("./WorkflowTasksContext");
41
42
  Object.defineProperty(exports, "WorkflowTasksContext", { enumerable: true, get: function () { return WorkflowTasksContext_1.WorkflowTasksContext; } });
42
43
  var RelatedObjectUrisContext_1 = require("./RelatedObjectUrisContext");
@@ -12,7 +12,7 @@ import { useDispatch, useSelector } from 'react-redux';
12
12
  import mdmModule, { search as mdmModuleSearch, ui as mdmModuleUi } from '@reltio/mdm-module';
13
13
  import { getEntityUriForLink } from '@reltio/mdm-sdk';
14
14
  import { map, pipe, prop, reject } from 'ramda';
15
- import { useActionsHook, ViewIdContext } from '../../../contexts';
15
+ import { useEntityLoadingIndication, useActionsHook, ViewIdContext } from '../../../contexts';
16
16
  import { useSafePromise } from '../../../hooks';
17
17
  import { getSearchProvider } from '../searchProviders/SearchProviderFactory';
18
18
  import { applyMergeToSearchNavigationData } from '../helpers';
@@ -32,6 +32,7 @@ var useSearchNavigation = function () {
32
32
  var globalSearchRequestOptions = useSelector(function (state) {
33
33
  return mdmModule.selectors.getGlobalSearchRequestOptions(state, ['ovOnly']);
34
34
  });
35
+ var updateEntitiesNavigationLoadingState = useEntityLoadingIndication().updateEntitiesNavigationLoadingState;
35
36
  var viewId = useContext(ViewIdContext);
36
37
  var dispatch = useDispatch();
37
38
  var _c = useState(false), loading = _c[0], setLoading = _c[1];
@@ -223,6 +224,12 @@ var useSearchNavigation = function () {
223
224
  stepForwardWithCheck(cache, cacheIndex, total, index);
224
225
  }
225
226
  }, [stepForwardWithCheck, cache, uri, total, index]);
227
+ useEffect(function () {
228
+ updateEntitiesNavigationLoadingState(loading);
229
+ }, [updateEntitiesNavigationLoadingState, loading]);
230
+ useEffect(function () {
231
+ return function () { return updateEntitiesNavigationLoadingState(false); };
232
+ }, []);
226
233
  var isPrevDisabled = loading || index <= 0;
227
234
  var isNextDisabled = loading || index >= total - 1;
228
235
  return { total: total, onPrev: onPrev, onNext: onNext, onSearchResultsClick: onSearchResultsClick, isPrevDisabled: isPrevDisabled, isNextDisabled: isNextDisabled };
@@ -1,2 +1,13 @@
1
1
  import React from 'react';
2
- export declare const EntityLoadingIndicationContext: React.Context<(value: boolean) => void>;
2
+ declare type ContextValue = {
3
+ isLoading: boolean;
4
+ updateEntityLoadingState: (loading: boolean) => void;
5
+ updateEntitiesNavigationLoadingState: (loading: boolean) => void;
6
+ resetLoadingState: () => void;
7
+ };
8
+ declare type Props = {
9
+ children: React.ReactNode;
10
+ };
11
+ export declare const EntityLoadingIndicationProvider: ({ children }: Props) => JSX.Element;
12
+ export declare const useEntityLoadingIndication: () => ContextValue;
13
+ export {};
@@ -1,4 +1,42 @@
1
- import React from 'react';
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import React, { useState, useCallback, useContext } from 'react';
2
13
  import { noop } from '../../core/utils';
3
- export var EntityLoadingIndicationContext = React.createContext(noop);
4
- EntityLoadingIndicationContext.displayName = 'EntityLoadingIndicationContext';
14
+ var EntityLoadingIndicationContext = React.createContext({
15
+ isLoading: false,
16
+ updateEntityLoadingState: noop,
17
+ updateEntitiesNavigationLoadingState: noop,
18
+ resetLoadingState: noop
19
+ });
20
+ var defaultLoadingState = { entitiesNavigation: false, entity: false };
21
+ var useEntityLoadingIndicationHook = function () {
22
+ var _a = useState(defaultLoadingState), loadingState = _a[0], setLoadingState = _a[1];
23
+ var updateEntityLoadingState = useCallback(function (loading) {
24
+ setLoadingState(function (prevLoadingState) { return (__assign(__assign({}, prevLoadingState), { entity: loading })); });
25
+ }, []);
26
+ var updateEntitiesNavigationLoadingState = useCallback(function (loading) {
27
+ setLoadingState(function (prevLoadingState) { return (__assign(__assign({}, prevLoadingState), { entitiesNavigation: loading })); });
28
+ }, []);
29
+ var resetLoadingState = useCallback(function () {
30
+ setLoadingState(defaultLoadingState);
31
+ }, []);
32
+ var isLoading = Object.values(loadingState).includes(true);
33
+ return { isLoading: isLoading, updateEntityLoadingState: updateEntityLoadingState, updateEntitiesNavigationLoadingState: updateEntitiesNavigationLoadingState, resetLoadingState: resetLoadingState };
34
+ };
35
+ export var EntityLoadingIndicationProvider = function (_a) {
36
+ var children = _a.children;
37
+ var value = useEntityLoadingIndicationHook();
38
+ return React.createElement(EntityLoadingIndicationContext.Provider, { value: value }, children);
39
+ };
40
+ export var useEntityLoadingIndication = function () {
41
+ return useContext(EntityLoadingIndicationContext);
42
+ };
@@ -1,2 +1,2 @@
1
- export const ViewIdContext: React.Context<any>;
2
- import React from "react";
1
+ import React from 'react';
2
+ export declare const ViewIdContext: React.Context<string>;
@@ -12,7 +12,7 @@ export { EntitiesMapContext } from './EntitiesMapContext';
12
12
  export { CrosswalksDisplayProvider, useCrosswalkColor, useCrosswalkFocus, useCrosswalkHighlight, useHighlightedCrosswalks } from './CrosswalksDisplayContext';
13
13
  export { ExpandedAttributesProvider, useAttributeExpanded } from './ExpandedAttributesContext';
14
14
  export { EntityMarkerContext } from './EntityMarkerContext';
15
- export { EntityLoadingIndicationContext } from './EntityLoadingIndicationContext';
15
+ export { EntityLoadingIndicationProvider, useEntityLoadingIndication } from './EntityLoadingIndicationContext';
16
16
  export { WorkflowTasksContext } from './WorkflowTasksContext';
17
17
  export { RelatedObjectUrisContext } from './RelatedObjectUrisContext';
18
18
  export { EntityContext } from './EntityContext';
@@ -12,7 +12,7 @@ export { EntitiesMapContext } from './EntitiesMapContext';
12
12
  export { CrosswalksDisplayProvider, useCrosswalkColor, useCrosswalkFocus, useCrosswalkHighlight, useHighlightedCrosswalks } from './CrosswalksDisplayContext';
13
13
  export { ExpandedAttributesProvider, useAttributeExpanded } from './ExpandedAttributesContext';
14
14
  export { EntityMarkerContext } from './EntityMarkerContext';
15
- export { EntityLoadingIndicationContext } from './EntityLoadingIndicationContext';
15
+ export { EntityLoadingIndicationProvider, useEntityLoadingIndication } from './EntityLoadingIndicationContext';
16
16
  export { WorkflowTasksContext } from './WorkflowTasksContext';
17
17
  export { RelatedObjectUrisContext } from './RelatedObjectUrisContext';
18
18
  export { EntityContext } from './EntityContext';
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1519",
3
+ "version": "1.4.1520",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
7
7
  "dependencies": {
8
8
  "@date-io/moment": "^1.3.5",
9
9
  "@react-google-maps/api": "2.7.0",
10
- "@reltio/mdm-module": "^1.4.1519",
11
- "@reltio/mdm-sdk": "^1.4.1519",
10
+ "@reltio/mdm-module": "^1.4.1520",
11
+ "@reltio/mdm-sdk": "^1.4.1520",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",