@reltio/components 1.4.1669 → 1.4.1671
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/cjs/contexts/EntityLoadingIndicationContext/index.d.ts +1 -0
- package/cjs/contexts/EntityLoadingIndicationContext/index.js +23 -2
- package/cjs/contexts/MdmModuleContext/context.d.ts +2 -0
- package/cjs/contexts/MdmModuleContext/hooks.d.ts +2 -1
- package/esm/contexts/EntityLoadingIndicationContext/index.d.ts +1 -0
- package/esm/contexts/EntityLoadingIndicationContext/index.js +24 -3
- package/esm/contexts/MdmModuleContext/context.d.ts +2 -0
- package/esm/contexts/MdmModuleContext/hooks.d.ts +2 -1
- package/package.json +2 -2
|
@@ -36,14 +36,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.useEntityLoadingIndication = exports.EntityLoadingIndicationProvider = void 0;
|
|
38
38
|
var react_1 = __importStar(require("react"));
|
|
39
|
+
var ramda_1 = require("ramda");
|
|
39
40
|
var utils_1 = require("../../core/utils");
|
|
41
|
+
var contexts_1 = require("../../contexts");
|
|
40
42
|
var EntityLoadingIndicationContext = react_1.default.createContext({
|
|
41
43
|
isLoading: false,
|
|
44
|
+
isEmptyState: false,
|
|
42
45
|
updateEntityLoadingState: utils_1.noop,
|
|
43
46
|
updateEntitiesNavigationLoadingState: utils_1.noop,
|
|
44
47
|
resetLoadingState: utils_1.noop
|
|
45
48
|
});
|
|
46
|
-
var defaultLoadingState = { entitiesNavigation: false, entity: false };
|
|
49
|
+
var defaultLoadingState = { entitiesNavigation: false, entity: false, entityCleansing: false };
|
|
47
50
|
var useEntityLoadingIndicationHook = function () {
|
|
48
51
|
var _a = (0, react_1.useState)(defaultLoadingState), loadingState = _a[0], setLoadingState = _a[1];
|
|
49
52
|
var updateEntityLoadingState = (0, react_1.useCallback)(function (loading) {
|
|
@@ -52,11 +55,29 @@ var useEntityLoadingIndicationHook = function () {
|
|
|
52
55
|
var updateEntitiesNavigationLoadingState = (0, react_1.useCallback)(function (loading) {
|
|
53
56
|
setLoadingState(function (prevLoadingState) { return (__assign(__assign({}, prevLoadingState), { entitiesNavigation: loading })); });
|
|
54
57
|
}, []);
|
|
58
|
+
var updateEntityCleansingLoadingState = (0, react_1.useCallback)(function (loading) {
|
|
59
|
+
setLoadingState(function (prevLoadingState) { return (__assign(__assign({}, prevLoadingState), { entityCleansing: loading })); });
|
|
60
|
+
}, []);
|
|
55
61
|
var resetLoadingState = (0, react_1.useCallback)(function () {
|
|
56
62
|
setLoadingState(defaultLoadingState);
|
|
57
63
|
}, []);
|
|
64
|
+
var listenToActions = (0, contexts_1.useActionsHook)();
|
|
65
|
+
var cleanseLoadingListener = (0, contexts_1.useMdmListener)('cleanseLoadingListener');
|
|
66
|
+
var listenerCallback = (0, react_1.useMemo)(function () { return cleanseLoadingListener(updateEntityCleansingLoadingState); }, [cleanseLoadingListener, updateEntityCleansingLoadingState]);
|
|
67
|
+
(0, react_1.useEffect)(function () {
|
|
68
|
+
var stopListeningActions = listenToActions(listenerCallback);
|
|
69
|
+
return function () { return stopListeningActions(); };
|
|
70
|
+
}, [listenerCallback, listenToActions]);
|
|
58
71
|
var isLoading = Object.values(loadingState).includes(true);
|
|
59
|
-
|
|
72
|
+
var isEmptyState = (0, ramda_1.pipe)((0, ramda_1.omit)(['entityCleansing']), ramda_1.values, (0, ramda_1.includes)(true))(loadingState);
|
|
73
|
+
return {
|
|
74
|
+
isLoading: isLoading,
|
|
75
|
+
isEmptyState: isEmptyState,
|
|
76
|
+
updateEntityLoadingState: updateEntityLoadingState,
|
|
77
|
+
updateEntitiesNavigationLoadingState: updateEntitiesNavigationLoadingState,
|
|
78
|
+
updateEntityCleansingLoadingState: updateEntityCleansingLoadingState,
|
|
79
|
+
resetLoadingState: resetLoadingState
|
|
80
|
+
};
|
|
60
81
|
};
|
|
61
82
|
var EntityLoadingIndicationProvider = function (_a) {
|
|
62
83
|
var children = _a.children;
|
|
@@ -121,6 +121,7 @@ export type MdmModuleActionsContextProps = Partial<{
|
|
|
121
121
|
}>;
|
|
122
122
|
export type MdmModuleListenersContextProps = Partial<{
|
|
123
123
|
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
124
|
+
cleanseLoadingListener: (callback: (value: boolean) => void) => (action: AnyAction) => void;
|
|
124
125
|
searchNavigationListener: (action: AnyAction, state: any, dispatch: (action: AnyAction) => void) => void;
|
|
125
126
|
}>;
|
|
126
127
|
export declare const MdmModuleActionsContext: import("@fluentui/react-context-selector").Context<Partial<{
|
|
@@ -244,5 +245,6 @@ export declare const MdmModuleValuesContext: import("@fluentui/react-context-sel
|
|
|
244
245
|
}>>;
|
|
245
246
|
export declare const MdmModuleListenersContext: import("@fluentui/react-context-selector").Context<Partial<{
|
|
246
247
|
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
248
|
+
cleanseLoadingListener: (callback: (value: boolean) => void) => (action: AnyAction) => void;
|
|
247
249
|
searchNavigationListener: (action: AnyAction, state: any, dispatch: (action: AnyAction) => void) => void;
|
|
248
250
|
}>>;
|
|
@@ -136,7 +136,8 @@ export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent"
|
|
|
136
136
|
addRelation: (id: string, connection: import("@reltio/mdm-sdk").Connection) => void;
|
|
137
137
|
editRelation: (id: string, connection: import("@reltio/mdm-sdk").Connection) => void;
|
|
138
138
|
}>[T];
|
|
139
|
-
export declare const useMdmListener: <T extends "expandInvalidRelatonsListener" | "searchNavigationListener">(listener: T) => Partial<{
|
|
139
|
+
export declare const useMdmListener: <T extends "expandInvalidRelatonsListener" | "cleanseLoadingListener" | "searchNavigationListener">(listener: T) => Partial<{
|
|
140
140
|
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
141
|
+
cleanseLoadingListener: (callback: (value: boolean) => void) => (action: import("../..").AnyAction) => void;
|
|
141
142
|
searchNavigationListener: (action: import("../..").AnyAction, state: any, dispatch: (action: import("../..").AnyAction) => void) => void;
|
|
142
143
|
}>[T];
|
|
@@ -9,15 +9,18 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import React, {
|
|
12
|
+
import React, { useCallback, useContext, useEffect, useState, useMemo } from 'react';
|
|
13
|
+
import { includes, omit, pipe, values } from 'ramda';
|
|
13
14
|
import { noop } from '../../core/utils';
|
|
15
|
+
import { useActionsHook, useMdmListener } from '../../contexts';
|
|
14
16
|
var EntityLoadingIndicationContext = React.createContext({
|
|
15
17
|
isLoading: false,
|
|
18
|
+
isEmptyState: false,
|
|
16
19
|
updateEntityLoadingState: noop,
|
|
17
20
|
updateEntitiesNavigationLoadingState: noop,
|
|
18
21
|
resetLoadingState: noop
|
|
19
22
|
});
|
|
20
|
-
var defaultLoadingState = { entitiesNavigation: false, entity: false };
|
|
23
|
+
var defaultLoadingState = { entitiesNavigation: false, entity: false, entityCleansing: false };
|
|
21
24
|
var useEntityLoadingIndicationHook = function () {
|
|
22
25
|
var _a = useState(defaultLoadingState), loadingState = _a[0], setLoadingState = _a[1];
|
|
23
26
|
var updateEntityLoadingState = useCallback(function (loading) {
|
|
@@ -26,11 +29,29 @@ var useEntityLoadingIndicationHook = function () {
|
|
|
26
29
|
var updateEntitiesNavigationLoadingState = useCallback(function (loading) {
|
|
27
30
|
setLoadingState(function (prevLoadingState) { return (__assign(__assign({}, prevLoadingState), { entitiesNavigation: loading })); });
|
|
28
31
|
}, []);
|
|
32
|
+
var updateEntityCleansingLoadingState = useCallback(function (loading) {
|
|
33
|
+
setLoadingState(function (prevLoadingState) { return (__assign(__assign({}, prevLoadingState), { entityCleansing: loading })); });
|
|
34
|
+
}, []);
|
|
29
35
|
var resetLoadingState = useCallback(function () {
|
|
30
36
|
setLoadingState(defaultLoadingState);
|
|
31
37
|
}, []);
|
|
38
|
+
var listenToActions = useActionsHook();
|
|
39
|
+
var cleanseLoadingListener = useMdmListener('cleanseLoadingListener');
|
|
40
|
+
var listenerCallback = useMemo(function () { return cleanseLoadingListener(updateEntityCleansingLoadingState); }, [cleanseLoadingListener, updateEntityCleansingLoadingState]);
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
var stopListeningActions = listenToActions(listenerCallback);
|
|
43
|
+
return function () { return stopListeningActions(); };
|
|
44
|
+
}, [listenerCallback, listenToActions]);
|
|
32
45
|
var isLoading = Object.values(loadingState).includes(true);
|
|
33
|
-
|
|
46
|
+
var isEmptyState = pipe(omit(['entityCleansing']), values, includes(true))(loadingState);
|
|
47
|
+
return {
|
|
48
|
+
isLoading: isLoading,
|
|
49
|
+
isEmptyState: isEmptyState,
|
|
50
|
+
updateEntityLoadingState: updateEntityLoadingState,
|
|
51
|
+
updateEntitiesNavigationLoadingState: updateEntitiesNavigationLoadingState,
|
|
52
|
+
updateEntityCleansingLoadingState: updateEntityCleansingLoadingState,
|
|
53
|
+
resetLoadingState: resetLoadingState
|
|
54
|
+
};
|
|
34
55
|
};
|
|
35
56
|
export var EntityLoadingIndicationProvider = function (_a) {
|
|
36
57
|
var children = _a.children;
|
|
@@ -121,6 +121,7 @@ export type MdmModuleActionsContextProps = Partial<{
|
|
|
121
121
|
}>;
|
|
122
122
|
export type MdmModuleListenersContextProps = Partial<{
|
|
123
123
|
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
124
|
+
cleanseLoadingListener: (callback: (value: boolean) => void) => (action: AnyAction) => void;
|
|
124
125
|
searchNavigationListener: (action: AnyAction, state: any, dispatch: (action: AnyAction) => void) => void;
|
|
125
126
|
}>;
|
|
126
127
|
export declare const MdmModuleActionsContext: import("@fluentui/react-context-selector").Context<Partial<{
|
|
@@ -244,5 +245,6 @@ export declare const MdmModuleValuesContext: import("@fluentui/react-context-sel
|
|
|
244
245
|
}>>;
|
|
245
246
|
export declare const MdmModuleListenersContext: import("@fluentui/react-context-selector").Context<Partial<{
|
|
246
247
|
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
248
|
+
cleanseLoadingListener: (callback: (value: boolean) => void) => (action: AnyAction) => void;
|
|
247
249
|
searchNavigationListener: (action: AnyAction, state: any, dispatch: (action: AnyAction) => void) => void;
|
|
248
250
|
}>>;
|
|
@@ -136,7 +136,8 @@ export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent"
|
|
|
136
136
|
addRelation: (id: string, connection: import("@reltio/mdm-sdk").Connection) => void;
|
|
137
137
|
editRelation: (id: string, connection: import("@reltio/mdm-sdk").Connection) => void;
|
|
138
138
|
}>[T];
|
|
139
|
-
export declare const useMdmListener: <T extends "expandInvalidRelatonsListener" | "searchNavigationListener">(listener: T) => Partial<{
|
|
139
|
+
export declare const useMdmListener: <T extends "expandInvalidRelatonsListener" | "cleanseLoadingListener" | "searchNavigationListener">(listener: T) => Partial<{
|
|
140
140
|
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
141
|
+
cleanseLoadingListener: (callback: (value: boolean) => void) => (action: import("../..").AnyAction) => void;
|
|
141
142
|
searchNavigationListener: (action: import("../..").AnyAction, state: any, dispatch: (action: import("../..").AnyAction) => void) => void;
|
|
142
143
|
}>[T];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1671",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@date-io/moment": "^1.3.5",
|
|
9
9
|
"@fluentui/react-context-selector": "^9.1.26",
|
|
10
10
|
"@react-google-maps/api": "2.7.0",
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1671",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|