@reltio/components 1.4.1773 → 1.4.1775
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/components/history/hooks/useHistoryDiff.js +4 -0
- package/cjs/components/history/hooks/useHistorySlice.js +8 -0
- package/cjs/contexts/MdmModuleContext/context.d.ts +2 -0
- package/cjs/contexts/MdmModuleContext/hooks.d.ts +2 -1
- package/esm/components/history/hooks/useHistoryDiff.js +4 -0
- package/esm/components/history/hooks/useHistorySlice.js +10 -2
- package/esm/contexts/MdmModuleContext/context.d.ts +2 -0
- package/esm/contexts/MdmModuleContext/hooks.d.ts +2 -1
- package/package.json +2 -2
|
@@ -25,6 +25,7 @@ var prepareHistorySlice = function (historySlice) {
|
|
|
25
25
|
};
|
|
26
26
|
var useHistoryDiff = function () {
|
|
27
27
|
var setHistoryDiff = (0, contexts_1.useMdmAction)('setHistoryDiff');
|
|
28
|
+
var clearHistoryDiff = (0, contexts_1.useMdmAction)('clearHistoryDiff');
|
|
28
29
|
var historySlice = (0, contexts_1.useMdmHistorySlice)();
|
|
29
30
|
var historyDiff = (0, contexts_1.useMdmHistoryDiff)();
|
|
30
31
|
var historyMode = (0, contexts_1.useMdmHistoryMode)();
|
|
@@ -36,6 +37,9 @@ var useHistoryDiff = function () {
|
|
|
36
37
|
var historyDiff_1 = historyManager.computeEntityHistoryDiff(prepareHistorySlice(historyMode === mdm_sdk_1.HistoryMode.Current ? entity : bEntity), prepareHistorySlice(aEntity));
|
|
37
38
|
setHistoryDiff(historyDiff_1);
|
|
38
39
|
}
|
|
40
|
+
else {
|
|
41
|
+
clearHistoryDiff();
|
|
42
|
+
}
|
|
39
43
|
}, [historySlice, historyMode, setHistoryDiff, entity]);
|
|
40
44
|
return historyDiff || exports.defaultHistoryDiff;
|
|
41
45
|
};
|
|
@@ -9,10 +9,18 @@ var useHistorySlice = function (_a) {
|
|
|
9
9
|
var entity = _a.entity, historyEvent = _a.historyEvent;
|
|
10
10
|
var _b = (0, react_1.useState)(false), isLoading = _b[0], setIsLoading = _b[1];
|
|
11
11
|
var setHistorySlice = (0, contexts_1.useMdmAction)('setHistorySlice');
|
|
12
|
+
var clearHistoryEvent = (0, contexts_1.useMdmAction)('clearHistoryEvent');
|
|
12
13
|
var historySlice = (0, contexts_1.useMdmHistorySlice)();
|
|
13
14
|
var safePromise = (0, hooks_1.useSafePromise)();
|
|
15
|
+
var mode = (0, contexts_1.useMdmMode)();
|
|
14
16
|
var _c = historyEvent || {}, aStamp = _c.aStamp, bStamp = _c.bStamp, overrideUri = _c.overrideUri;
|
|
15
17
|
var entityUri = overrideUri || (entity === null || entity === void 0 ? void 0 : entity.uri);
|
|
18
|
+
(0, react_1.useEffect)(function () {
|
|
19
|
+
if ((0, mdm_sdk_1.isEditableMode)(mode) && entityUri) {
|
|
20
|
+
safePromise(Promise.resolve());
|
|
21
|
+
clearHistoryEvent();
|
|
22
|
+
}
|
|
23
|
+
}, [mode, entityUri]);
|
|
16
24
|
(0, react_1.useEffect)(function () {
|
|
17
25
|
if (historyEvent && entityUri) {
|
|
18
26
|
setIsLoading(true);
|
|
@@ -93,6 +93,7 @@ export type MdmModuleActionsContextProps = Partial<{
|
|
|
93
93
|
modeUpdated: (payload: Mode) => void;
|
|
94
94
|
setHistoryEvent: (payload: HistoryEvent) => void;
|
|
95
95
|
clearHistoryEvent: () => void;
|
|
96
|
+
clearHistoryDiff: () => void;
|
|
96
97
|
setHistoryDiff: (payload: HistoryDiff) => void;
|
|
97
98
|
setHistorySlice: (payload: HistorySlice) => void;
|
|
98
99
|
updateSearchNavigationDataFields: (payload: Partial<SearchNavigationData>) => void;
|
|
@@ -158,6 +159,7 @@ export declare const MdmModuleActionsContext: import("@fluentui/react-context-se
|
|
|
158
159
|
modeUpdated: (payload: Mode) => void;
|
|
159
160
|
setHistoryEvent: (payload: HistoryEvent) => void;
|
|
160
161
|
clearHistoryEvent: () => void;
|
|
162
|
+
clearHistoryDiff: () => void;
|
|
161
163
|
setHistoryDiff: (payload: HistoryDiff) => void;
|
|
162
164
|
setHistorySlice: (payload: HistorySlice) => void;
|
|
163
165
|
updateSearchNavigationDataFields: (payload: Partial<SearchNavigationData>) => void;
|
|
@@ -70,7 +70,7 @@ export declare const useMdmDependentLookupEditorContext: (attributeValue: Simple
|
|
|
70
70
|
};
|
|
71
71
|
export declare const useMdmGlobalSearchRequestOptions: (omittingFields?: string[]) => import("@reltio/mdm-sdk").GlobalSearchRequestOptions;
|
|
72
72
|
export declare const useMdmAuthoringItemsByEntityType: (entityTypeUri: string) => import("@reltio/mdm-sdk").AuthoringItem[];
|
|
73
|
-
export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent" | "openConsoleApp" | "addAttributes" | "modifyAttribute" | "removeAttribute" | "entityDeleted" | "entityCreated" | "errorDeactivated" | "requestNextPageOfAttributeValues" | "openEntity" | "setDefaultProfilePicForModifiedEntity" | "setDefaultProfilePicForEntity" | "dependentLookupsEditorTouched" | "openPivotingPerspective" | "lookupsLoaded" | "lookupsForTypeResolved" | "errorSet" | "setHistoryMode" | "modeUpdated" | "setHistoryEvent" | "clearHistoryEvent" | "setHistoryDiff" | "setHistorySlice" | "updateSearchNavigationDataFields" | "openPerspective" | "entityDeletionFinished" | "loadEntity" | "updateSearchNavigationDataOnMerge" | "lookupsListResolved" | "relationsLoaded" | "setInitialInfo" | "setRelationType" | "closeRelationEditor" | "openRelationEditor" | "setRelationEntity" | "errorsSet" | "addRelation" | "editRelation">(action: T) => Partial<{
|
|
73
|
+
export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent" | "openConsoleApp" | "addAttributes" | "modifyAttribute" | "removeAttribute" | "entityDeleted" | "entityCreated" | "errorDeactivated" | "requestNextPageOfAttributeValues" | "openEntity" | "setDefaultProfilePicForModifiedEntity" | "setDefaultProfilePicForEntity" | "dependentLookupsEditorTouched" | "openPivotingPerspective" | "lookupsLoaded" | "lookupsForTypeResolved" | "errorSet" | "setHistoryMode" | "modeUpdated" | "setHistoryEvent" | "clearHistoryEvent" | "clearHistoryDiff" | "setHistoryDiff" | "setHistorySlice" | "updateSearchNavigationDataFields" | "openPerspective" | "entityDeletionFinished" | "loadEntity" | "updateSearchNavigationDataOnMerge" | "lookupsListResolved" | "relationsLoaded" | "setInitialInfo" | "setRelationType" | "closeRelationEditor" | "openRelationEditor" | "setRelationEntity" | "errorsSet" | "addRelation" | "editRelation">(action: T) => Partial<{
|
|
74
74
|
openSearch: (payload: import("@reltio/mdm-sdk").SearchState) => void;
|
|
75
75
|
openHistoryEvent: (payload: {
|
|
76
76
|
entityUri: string;
|
|
@@ -109,6 +109,7 @@ export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent"
|
|
|
109
109
|
modeUpdated: (payload: import("@reltio/mdm-sdk").Mode) => void;
|
|
110
110
|
setHistoryEvent: (payload: import("@reltio/mdm-sdk").HistoryEvent) => void;
|
|
111
111
|
clearHistoryEvent: () => void;
|
|
112
|
+
clearHistoryDiff: () => void;
|
|
112
113
|
setHistoryDiff: (payload: import("@reltio/mdm-sdk").HistoryDiff) => void;
|
|
113
114
|
setHistorySlice: (payload: import("@reltio/mdm-sdk").HistorySlice) => void;
|
|
114
115
|
updateSearchNavigationDataFields: (payload: Partial<import("@reltio/mdm-sdk").SearchNavigationData>) => void;
|
|
@@ -22,6 +22,7 @@ var prepareHistorySlice = function (historySlice) {
|
|
|
22
22
|
};
|
|
23
23
|
export var useHistoryDiff = function () {
|
|
24
24
|
var setHistoryDiff = useMdmAction('setHistoryDiff');
|
|
25
|
+
var clearHistoryDiff = useMdmAction('clearHistoryDiff');
|
|
25
26
|
var historySlice = useMdmHistorySlice();
|
|
26
27
|
var historyDiff = useMdmHistoryDiff();
|
|
27
28
|
var historyMode = useMdmHistoryMode();
|
|
@@ -33,6 +34,9 @@ export var useHistoryDiff = function () {
|
|
|
33
34
|
var historyDiff_1 = historyManager.computeEntityHistoryDiff(prepareHistorySlice(historyMode === HistoryMode.Current ? entity : bEntity), prepareHistorySlice(aEntity));
|
|
34
35
|
setHistoryDiff(historyDiff_1);
|
|
35
36
|
}
|
|
37
|
+
else {
|
|
38
|
+
clearHistoryDiff();
|
|
39
|
+
}
|
|
36
40
|
}, [historySlice, historyMode, setHistoryDiff, entity]);
|
|
37
41
|
return historyDiff || defaultHistoryDiff;
|
|
38
42
|
};
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
|
-
import { getEntityTimeSlice } from '@reltio/mdm-sdk';
|
|
2
|
+
import { getEntityTimeSlice, isEditableMode } from '@reltio/mdm-sdk';
|
|
3
3
|
import { useSafePromise } from '../../../hooks';
|
|
4
|
-
import { useMdmAction, useMdmHistorySlice } from '../../../contexts';
|
|
4
|
+
import { useMdmAction, useMdmHistorySlice, useMdmMode } from '../../../contexts';
|
|
5
5
|
export var useHistorySlice = function (_a) {
|
|
6
6
|
var entity = _a.entity, historyEvent = _a.historyEvent;
|
|
7
7
|
var _b = useState(false), isLoading = _b[0], setIsLoading = _b[1];
|
|
8
8
|
var setHistorySlice = useMdmAction('setHistorySlice');
|
|
9
|
+
var clearHistoryEvent = useMdmAction('clearHistoryEvent');
|
|
9
10
|
var historySlice = useMdmHistorySlice();
|
|
10
11
|
var safePromise = useSafePromise();
|
|
12
|
+
var mode = useMdmMode();
|
|
11
13
|
var _c = historyEvent || {}, aStamp = _c.aStamp, bStamp = _c.bStamp, overrideUri = _c.overrideUri;
|
|
12
14
|
var entityUri = overrideUri || (entity === null || entity === void 0 ? void 0 : entity.uri);
|
|
15
|
+
useEffect(function () {
|
|
16
|
+
if (isEditableMode(mode) && entityUri) {
|
|
17
|
+
safePromise(Promise.resolve());
|
|
18
|
+
clearHistoryEvent();
|
|
19
|
+
}
|
|
20
|
+
}, [mode, entityUri]);
|
|
13
21
|
useEffect(function () {
|
|
14
22
|
if (historyEvent && entityUri) {
|
|
15
23
|
setIsLoading(true);
|
|
@@ -93,6 +93,7 @@ export type MdmModuleActionsContextProps = Partial<{
|
|
|
93
93
|
modeUpdated: (payload: Mode) => void;
|
|
94
94
|
setHistoryEvent: (payload: HistoryEvent) => void;
|
|
95
95
|
clearHistoryEvent: () => void;
|
|
96
|
+
clearHistoryDiff: () => void;
|
|
96
97
|
setHistoryDiff: (payload: HistoryDiff) => void;
|
|
97
98
|
setHistorySlice: (payload: HistorySlice) => void;
|
|
98
99
|
updateSearchNavigationDataFields: (payload: Partial<SearchNavigationData>) => void;
|
|
@@ -158,6 +159,7 @@ export declare const MdmModuleActionsContext: import("@fluentui/react-context-se
|
|
|
158
159
|
modeUpdated: (payload: Mode) => void;
|
|
159
160
|
setHistoryEvent: (payload: HistoryEvent) => void;
|
|
160
161
|
clearHistoryEvent: () => void;
|
|
162
|
+
clearHistoryDiff: () => void;
|
|
161
163
|
setHistoryDiff: (payload: HistoryDiff) => void;
|
|
162
164
|
setHistorySlice: (payload: HistorySlice) => void;
|
|
163
165
|
updateSearchNavigationDataFields: (payload: Partial<SearchNavigationData>) => void;
|
|
@@ -70,7 +70,7 @@ export declare const useMdmDependentLookupEditorContext: (attributeValue: Simple
|
|
|
70
70
|
};
|
|
71
71
|
export declare const useMdmGlobalSearchRequestOptions: (omittingFields?: string[]) => import("@reltio/mdm-sdk").GlobalSearchRequestOptions;
|
|
72
72
|
export declare const useMdmAuthoringItemsByEntityType: (entityTypeUri: string) => import("@reltio/mdm-sdk").AuthoringItem[];
|
|
73
|
-
export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent" | "openConsoleApp" | "addAttributes" | "modifyAttribute" | "removeAttribute" | "entityDeleted" | "entityCreated" | "errorDeactivated" | "requestNextPageOfAttributeValues" | "openEntity" | "setDefaultProfilePicForModifiedEntity" | "setDefaultProfilePicForEntity" | "dependentLookupsEditorTouched" | "openPivotingPerspective" | "lookupsLoaded" | "lookupsForTypeResolved" | "errorSet" | "setHistoryMode" | "modeUpdated" | "setHistoryEvent" | "clearHistoryEvent" | "setHistoryDiff" | "setHistorySlice" | "updateSearchNavigationDataFields" | "openPerspective" | "entityDeletionFinished" | "loadEntity" | "updateSearchNavigationDataOnMerge" | "lookupsListResolved" | "relationsLoaded" | "setInitialInfo" | "setRelationType" | "closeRelationEditor" | "openRelationEditor" | "setRelationEntity" | "errorsSet" | "addRelation" | "editRelation">(action: T) => Partial<{
|
|
73
|
+
export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent" | "openConsoleApp" | "addAttributes" | "modifyAttribute" | "removeAttribute" | "entityDeleted" | "entityCreated" | "errorDeactivated" | "requestNextPageOfAttributeValues" | "openEntity" | "setDefaultProfilePicForModifiedEntity" | "setDefaultProfilePicForEntity" | "dependentLookupsEditorTouched" | "openPivotingPerspective" | "lookupsLoaded" | "lookupsForTypeResolved" | "errorSet" | "setHistoryMode" | "modeUpdated" | "setHistoryEvent" | "clearHistoryEvent" | "clearHistoryDiff" | "setHistoryDiff" | "setHistorySlice" | "updateSearchNavigationDataFields" | "openPerspective" | "entityDeletionFinished" | "loadEntity" | "updateSearchNavigationDataOnMerge" | "lookupsListResolved" | "relationsLoaded" | "setInitialInfo" | "setRelationType" | "closeRelationEditor" | "openRelationEditor" | "setRelationEntity" | "errorsSet" | "addRelation" | "editRelation">(action: T) => Partial<{
|
|
74
74
|
openSearch: (payload: import("@reltio/mdm-sdk").SearchState) => void;
|
|
75
75
|
openHistoryEvent: (payload: {
|
|
76
76
|
entityUri: string;
|
|
@@ -109,6 +109,7 @@ export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent"
|
|
|
109
109
|
modeUpdated: (payload: import("@reltio/mdm-sdk").Mode) => void;
|
|
110
110
|
setHistoryEvent: (payload: import("@reltio/mdm-sdk").HistoryEvent) => void;
|
|
111
111
|
clearHistoryEvent: () => void;
|
|
112
|
+
clearHistoryDiff: () => void;
|
|
112
113
|
setHistoryDiff: (payload: import("@reltio/mdm-sdk").HistoryDiff) => void;
|
|
113
114
|
setHistorySlice: (payload: import("@reltio/mdm-sdk").HistorySlice) => void;
|
|
114
115
|
updateSearchNavigationDataFields: (payload: Partial<import("@reltio/mdm-sdk").SearchNavigationData>) => void;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1775",
|
|
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
|
"@fluentui/react-context-selector": "^9.1.26",
|
|
9
9
|
"@react-google-maps/api": "2.7.0",
|
|
10
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
10
|
+
"@reltio/mdm-sdk": "^1.4.1749",
|
|
11
11
|
"classnames": "^2.2.5",
|
|
12
12
|
"d3-cloud": "^1.2.5",
|
|
13
13
|
"d3-geo": "^2.0.1",
|