@reltio/components 1.4.969 → 1.4.973
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/attributes/editMode/SimpleAttributeEditor/selectors/helpers/parents.js +12 -2
- package/cjs/components/history/HistoryGraph/HistoryGraph.js +13 -8
- package/cjs/components/history/hooks/useHistoryTree.js +28 -27
- package/cjs/components/history/types/HistoryRowData.d.ts +1 -0
- package/cjs/hooks/useCollaboration.js +1 -1
- package/cjs/hooks/useRelationsLoader.d.ts +1 -0
- package/cjs/hooks/useRelationsLoader.js +8 -3
- package/esm/components/attributes/editMode/SimpleAttributeEditor/selectors/helpers/parents.js +14 -4
- package/esm/components/history/HistoryGraph/HistoryGraph.js +13 -8
- package/esm/components/history/hooks/useHistoryTree.js +29 -28
- package/esm/components/history/types/HistoryRowData.d.ts +1 -0
- package/esm/hooks/useCollaboration.js +1 -1
- package/esm/hooks/useRelationsLoader.d.ts +1 -0
- package/esm/hooks/useRelationsLoader.js +10 -5
- package/package.json +3 -3
package/cjs/components/attributes/editMode/SimpleAttributeEditor/selectors/helpers/parents.js
CHANGED
|
@@ -24,6 +24,7 @@ var ramda_1 = require("ramda");
|
|
|
24
24
|
var mdm_module_1 = __importDefault(require("@reltio/mdm-module"));
|
|
25
25
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
26
26
|
var getParents = function (state, valueUri, node) {
|
|
27
|
+
var _a;
|
|
27
28
|
var parentNodesValues = node.parents.flatMap(function (type) {
|
|
28
29
|
var parentNode = mdm_module_1.default.selectors.getDependentLookupsStructureNode(state, type);
|
|
29
30
|
return parentNode.values.map(function (value) { return (__assign(__assign({}, value), { type: type, dependentLookupCode: parentNode.attrType.dependentLookupCode })); });
|
|
@@ -31,6 +32,7 @@ var getParents = function (state, valueUri, node) {
|
|
|
31
32
|
var modifiedEntities = mdm_module_1.default.selectors.getModifiedEntities(state);
|
|
32
33
|
var entityUri = mdm_module_1.default.selectors.getEntityUri(state);
|
|
33
34
|
var connections = mdm_module_1.default.selectors.getAllRelationsToAddAndEdit(state);
|
|
35
|
+
var metadata = mdm_module_1.default.selectors.getMetadata(state);
|
|
34
36
|
var ownParentNodesValues = mdm_sdk_1.filterRelatedParentValuesForDependentLookupValueUri({
|
|
35
37
|
parentValues: parentNodesValues,
|
|
36
38
|
valueUri: valueUri,
|
|
@@ -38,8 +40,16 @@ var getParents = function (state, valueUri, node) {
|
|
|
38
40
|
modifiedEntities: modifiedEntities,
|
|
39
41
|
connections: connections
|
|
40
42
|
});
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
+
var possibleParentBaseTypeUris = ramda_1.pipe(mdm_sdk_1.getAttributeValuePath, ramda_1.defaultTo([]), ramda_1.map(ramda_1.pipe(ramda_1.path(['valueType', 'uri']), mdm_sdk_1.getBaseUri)), ramda_1.prepend((_a = modifiedEntities[entityUri]) === null || _a === void 0 ? void 0 : _a.type), ramda_1.reject(ramda_1.isNil), ramda_1.uniq)({
|
|
44
|
+
entityUri: entityUri,
|
|
45
|
+
entitiesMap: modifiedEntities,
|
|
46
|
+
connections: connections,
|
|
47
|
+
metadata: metadata
|
|
48
|
+
}, valueUri);
|
|
49
|
+
var neededParentsAttributeTypes = node.parents
|
|
50
|
+
.filter(function (typeUri) { return possibleParentBaseTypeUris.some(mdm_sdk_1.areOneHierarchyUris(typeUri)); })
|
|
51
|
+
.map(function (typeUri) {
|
|
52
|
+
var parentNode = mdm_module_1.default.selectors.getDependentLookupsStructureNode(state, typeUri);
|
|
43
53
|
return parentNode.attrType;
|
|
44
54
|
});
|
|
45
55
|
var missedParentsAttributeTypes = neededParentsAttributeTypes.filter(function (attrType) { return !ownParentNodesValues.some(function (_a) {
|
|
@@ -37,14 +37,14 @@ var HistoryGraph = function (_a) {
|
|
|
37
37
|
var historyLanes = graphData.historyLanes, rows = graphData.rows;
|
|
38
38
|
var rowPositions = [ROW_MARGIN];
|
|
39
39
|
var _b = rows.reduce(function (acc, _a, i) {
|
|
40
|
-
var uri = _a.uri, height = _a.height, uris = _a.uris, type = _a.type, index = _a.index;
|
|
40
|
+
var uri = _a.uri, height = _a.height, uris = _a.uris, type = _a.type, fakeType = _a.fakeType, index = _a.index;
|
|
41
41
|
var x = historyLanes[uri].index * COL_WIDTH + COL_MARGIN;
|
|
42
42
|
var y = rowPositions[i];
|
|
43
43
|
rowPositions.push(y + height);
|
|
44
|
-
var
|
|
45
|
-
var circleUri =
|
|
44
|
+
var hasFakeType = helpers_1.isFakeHistoryType(fakeType);
|
|
45
|
+
var circleUri = hasFakeType ? uris[0] : uri;
|
|
46
46
|
var isCollapsed = !(uris === null || uris === void 0 ? void 0 : uris.some(function (uri) { return historyLanes[uri]; }));
|
|
47
|
-
acc.circles.push(react_1.default.createElement(HistoryCircle_1.default, { key: "circle-" + circleUri + "-" + i, x: x, y: y, color: mdm_sdk_1.getContributorColor(circleUri), isDashed:
|
|
47
|
+
acc.circles.push(react_1.default.createElement(HistoryCircle_1.default, { key: "circle-" + circleUri + "-" + i, x: x, y: y, color: mdm_sdk_1.getContributorColor(circleUri), isDashed: hasFakeType, isCollapsed: isCollapsed, showCollapseIcon: !!uris, showLine: fakeType === types_1.HistoryChangeTypes.FAKE_NAVIGATE_PROFILE }));
|
|
48
48
|
acc.rowLines.push(react_1.default.createElement("rect", { key: circleUri + "-" + index, x: x, y: y - ROW_HEIGHT / 2, width: '100%', height: ROW_HEIGHT, fill: mdm_sdk_1.getContributorColor(circleUri), opacity: 0.06 }));
|
|
49
49
|
var isUpRight = type === types_1.HistoryChangeTypes.ENTITIES_SPLITTED;
|
|
50
50
|
uris === null || uris === void 0 ? void 0 : uris.forEach(function (contributorUri) {
|
|
@@ -55,7 +55,7 @@ var HistoryGraph = function (_a) {
|
|
|
55
55
|
var toX = contributorLane.index * COL_WIDTH + COL_MARGIN;
|
|
56
56
|
var toY = isUpRight ? y - rowHeight : y + rowHeight;
|
|
57
57
|
if (x !== toX)
|
|
58
|
-
acc.links.push(react_1.default.createElement(HistoryLink_1.default, { key: "link-" + contributorUri + "-" + index, x: x, y: y, toX: toX, toY: toY, isDashed: helpers_1.isFakeHistoryType(
|
|
58
|
+
acc.links.push(react_1.default.createElement(HistoryLink_1.default, { key: "link-" + contributorUri + "-" + index, x: x, y: y, toX: toX, toY: toY, isDashed: helpers_1.isFakeHistoryType(fakeType), color: mdm_sdk_1.getContributorColor(contributorUri) }));
|
|
59
59
|
});
|
|
60
60
|
return acc;
|
|
61
61
|
}, { links: [], circles: [], rowLines: [] }), links = _b.links, rowLines = _b.rowLines, circles = _b.circles;
|
|
@@ -69,13 +69,18 @@ var HistoryGraph = function (_a) {
|
|
|
69
69
|
var start = _a.start, end = _a.end;
|
|
70
70
|
if (((_b = rows[end === null || end === void 0 ? void 0 : end.index]) === null || _b === void 0 ? void 0 : _b.type) === types_1.HistoryChangeTypes.ENTITIES_SPLITTED)
|
|
71
71
|
return;
|
|
72
|
-
var
|
|
73
|
-
var
|
|
72
|
+
var startIndex = (start === null || start === void 0 ? void 0 : start.type) === types_1.HistoryChangeTypes.ENTITIES_SPLITTED ? (start === null || start === void 0 ? void 0 : start.index) - 1 : start === null || start === void 0 ? void 0 : start.index;
|
|
73
|
+
var endIndex = (end === null || end === void 0 ? void 0 : end.type) === types_1.HistoryChangeTypes.ENTITIES_MERGED_MANUALLY ||
|
|
74
|
+
(end === null || end === void 0 ? void 0 : end.type) === types_1.HistoryChangeTypes.ENTITIES_MERGED
|
|
75
|
+
? (end === null || end === void 0 ? void 0 : end.index) + 1
|
|
76
|
+
: end === null || end === void 0 ? void 0 : end.index;
|
|
77
|
+
var startY = rowPositions[startIndex] || rowPositions[rowPositions.length - 2];
|
|
78
|
+
var endY = rowPositions[endIndex] || ROW_MARGIN;
|
|
74
79
|
var color = mdm_sdk_1.getContributorColor(contributorUri);
|
|
75
80
|
if (!end && contributorLane.index > 0) {
|
|
76
81
|
circles.push(react_1.default.createElement(HistoryCircle_1.default, { key: "initCircle-" + contributorUri + "-" + i, x: x, y: endY, color: color, showLine: true }));
|
|
77
82
|
}
|
|
78
|
-
links.
|
|
83
|
+
links.unshift(react_1.default.createElement("path", { key: "line-" + contributorUri + "-" + i, d: "M" + x + " " + startY + " L" + x + " " + endY, stroke: color, strokeWidth: 2 }));
|
|
79
84
|
});
|
|
80
85
|
});
|
|
81
86
|
return (react_1.default.createElement("svg", { className: "chart", width: width, height: height },
|
|
@@ -20,43 +20,42 @@ var useHistoryTree = function (_a) {
|
|
|
20
20
|
return react_1.useMemo(function () {
|
|
21
21
|
var _a;
|
|
22
22
|
var historyLanes = (_a = {}, _a[entityUri] = { index: 0, lifeTime: [] }, _a);
|
|
23
|
-
var rows = [
|
|
24
|
-
|
|
25
|
-
];
|
|
26
|
-
var checkChange = ramda_1.curry(function (involvedUris, change) {
|
|
23
|
+
var rows = [{ user: '', timestamp: 0, uri: entityUri }];
|
|
24
|
+
var checkChange = ramda_1.curry(function (involvedUris, checkInUris, change) {
|
|
27
25
|
var _a;
|
|
28
26
|
var uri = change.uri || entityUri;
|
|
29
|
-
if (
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
if (involvedUris) {
|
|
28
|
+
if (Array.isArray(involvedUris)) {
|
|
29
|
+
if (change.type !== types_1.HistoryChangeTypes.ENTITY_LOST_MERGE)
|
|
30
|
+
return null;
|
|
31
|
+
if (involvedUris.includes(uri)) {
|
|
32
|
+
return change;
|
|
33
|
+
}
|
|
34
|
+
else if (checkInUris && change.uris) {
|
|
35
|
+
return involvedUris.some(function (involvedUri) { return change.uris.includes(involvedUri); }) ? change : null;
|
|
36
|
+
}
|
|
34
37
|
}
|
|
35
|
-
else
|
|
36
|
-
|
|
38
|
+
else {
|
|
39
|
+
if (uri === involvedUris || (checkInUris && ((_a = change.uris) === null || _a === void 0 ? void 0 : _a.includes(involvedUris))))
|
|
40
|
+
return change;
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
|
-
else {
|
|
40
|
-
if (uri === involvedUris || ((_a = change.uris) === null || _a === void 0 ? void 0 : _a.includes(involvedUris)))
|
|
41
|
-
return change;
|
|
42
|
-
}
|
|
43
43
|
return null;
|
|
44
44
|
});
|
|
45
|
-
var findNextChange = function (index, involvedUris) {
|
|
46
|
-
return ramda_1.pipe(ramda_1.
|
|
45
|
+
var findNextChange = function (index, involvedUris, checkInUris) {
|
|
46
|
+
return ramda_1.pipe(ramda_1.drop(index + 1), ramda_1.find(checkChange(involvedUris, checkInUris)))(historyChanges);
|
|
47
47
|
};
|
|
48
48
|
var findPreviousChange = function (index, uri) {
|
|
49
|
-
return ramda_1.pipe(ramda_1.slice(index + 1, Infinity), ramda_1.find(checkChange(uri)))(rows);
|
|
49
|
+
return ramda_1.pipe(ramda_1.slice(index + 1, Infinity), ramda_1.find(checkChange(uri, false)))(rows);
|
|
50
50
|
};
|
|
51
51
|
var checkLaneUri = function (uri) {
|
|
52
|
-
|
|
53
|
-
if (!contributorLane && (!selectedUris || selectedUris.includes(uri))) {
|
|
52
|
+
if (!historyLanes[uri] && (!selectedUris || selectedUris.includes(uri))) {
|
|
54
53
|
historyLanes[uri] = {
|
|
55
54
|
index: Object.keys(historyLanes).length,
|
|
56
55
|
lifeTime: []
|
|
57
56
|
};
|
|
58
57
|
}
|
|
59
|
-
return
|
|
58
|
+
return historyLanes[uri];
|
|
60
59
|
};
|
|
61
60
|
var startNewLife = function (lifeTime, change) {
|
|
62
61
|
var currentLife = lifeTime[lifeTime.length - 1];
|
|
@@ -113,11 +112,12 @@ var useHistoryTree = function (_a) {
|
|
|
113
112
|
? startNewLife(relatedLane.lifeTime, change)
|
|
114
113
|
: endLife(relatedLane.lifeTime, change);
|
|
115
114
|
rows.push({
|
|
116
|
-
type: lifeTimeLength
|
|
117
|
-
? types_1.HistoryChangeTypes.FAKE_UPDATE
|
|
118
|
-
: types_1.HistoryChangeTypes.FAKE_NAVIGATE_PROFILE,
|
|
119
115
|
uri: uri,
|
|
120
116
|
user: change.user,
|
|
117
|
+
type: change.type,
|
|
118
|
+
fakeType: lifeTimeLength
|
|
119
|
+
? types_1.HistoryChangeTypes.FAKE_UPDATE
|
|
120
|
+
: types_1.HistoryChangeTypes.FAKE_NAVIGATE_PROFILE,
|
|
121
121
|
timestamp: change.timestamp
|
|
122
122
|
});
|
|
123
123
|
});
|
|
@@ -138,13 +138,13 @@ var useHistoryTree = function (_a) {
|
|
|
138
138
|
var _a;
|
|
139
139
|
switch (change.type) {
|
|
140
140
|
case types_1.HistoryChangeTypes.ENTITIES_SPLITTED:
|
|
141
|
-
if (!findNextChange(index, change.uri || entityUri)) {
|
|
141
|
+
if (!findNextChange(index, change.uri || entityUri, false)) {
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
144
|
else {
|
|
145
145
|
var uri = change.uri;
|
|
146
146
|
var involvedUris = change.uris ? [change.uris, uri] : [uri];
|
|
147
|
-
var lostMergeChange = findNextChange(index, involvedUris);
|
|
147
|
+
var lostMergeChange = findNextChange(index, involvedUris, true);
|
|
148
148
|
if (lostMergeChange && (!uri || uri === lostMergeChange.uri))
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
@@ -194,9 +194,10 @@ var useHistoryTree = function (_a) {
|
|
|
194
194
|
return;
|
|
195
195
|
}
|
|
196
196
|
var fakeChange = {
|
|
197
|
-
|
|
197
|
+
fakeType: fakeType,
|
|
198
198
|
uri: postChange.uri,
|
|
199
199
|
uris: [contributorUri],
|
|
200
|
+
type: type,
|
|
200
201
|
user: user,
|
|
201
202
|
timestamp: timestamp
|
|
202
203
|
};
|
|
@@ -168,7 +168,7 @@ var useCollaboration = function (_a) {
|
|
|
168
168
|
}
|
|
169
169
|
setCommentsMap(function (prevCommentsMap) {
|
|
170
170
|
var _a;
|
|
171
|
-
return (__assign(__assign({}, prevCommentsMap), (_a = {}, _a[uri] = prevCommentsMap[uri].map(function (comment) {
|
|
171
|
+
return (__assign(__assign({}, prevCommentsMap), (_a = {}, _a[uri] = (prevCommentsMap[uri] || []).map(function (comment) {
|
|
172
172
|
if (comment.commentId === commentId) {
|
|
173
173
|
return __assign(__assign({}, comment), { status: newStatus, replies: comment.replies + 1 });
|
|
174
174
|
}
|
|
@@ -38,6 +38,7 @@ var mdm_module_1 = __importStar(require("@reltio/mdm-module"));
|
|
|
38
38
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
39
39
|
var useSafePromise_1 = require("./useSafePromise");
|
|
40
40
|
var usePrevious_1 = require("./usePrevious");
|
|
41
|
+
var buildSuggestedIds = ramda_1.when(ramda_1.identity, ramda_1.pipe(mdm_sdk_1.wrapInArrayIfNeeded, ramda_1.length, ramda_1.times(function (n) { return n + 1; })));
|
|
41
42
|
var useRelationsLoader = function (_a) {
|
|
42
43
|
var sorting = _a.sorting, filter = _a.filter, page = _a.page, rowsPerPage = _a.rowsPerPage, config = _a.config, entity = _a.entity, relationActivityFilter = _a.relationActivityFilter, mode = _a.mode;
|
|
43
44
|
var _b = react_1.useState(false), isLoading = _b[0], setIsLoading = _b[1];
|
|
@@ -46,12 +47,16 @@ var useRelationsLoader = function (_a) {
|
|
|
46
47
|
var dtssPath = react_redux_1.useSelector(mdm_module_1.default.selectors.getDtssPath);
|
|
47
48
|
var _c = react_redux_1.useSelector(mdm_module_1.default.selectors.getGlobalSearchRequestOptions) || {}, activityFilter = _c.activityFilter, globalFilter = _c.globalFilter;
|
|
48
49
|
var safePromise = useSafePromise_1.useSafePromise();
|
|
50
|
+
var suggested = config.suggested;
|
|
49
51
|
var loadRelations = react_1.useCallback(function () {
|
|
50
52
|
if (entity === null || entity === void 0 ? void 0 : entity.uri) {
|
|
51
53
|
var requestConfig_1 = __assign(__assign({}, config.content), { sortBy: sorting === null || sorting === void 0 ? void 0 : sorting.field, order: sorting === null || sorting === void 0 ? void 0 : sorting.order, returnDates: true, returnObjects: true, activeness: {
|
|
52
54
|
relation: relationActivityFilter || mdm_sdk_1.ActivityFilter.ALL,
|
|
53
55
|
entity: activityFilter
|
|
54
|
-
}, max: rowsPerPage, offset: page * rowsPerPage, filter: mdm_sdk_1.addGlobalFilterToQuery(globalFilter, filter) || undefined });
|
|
56
|
+
}, max: rowsPerPage, offset: page * rowsPerPage, filter: mdm_sdk_1.addGlobalFilterToQuery(globalFilter, filter) || undefined, suggested: buildSuggestedIds(suggested) });
|
|
57
|
+
var configs_1 = [requestConfig_1].concat(ramda_1.ifElse(ramda_1.identity, ramda_1.pipe(mdm_sdk_1.wrapInArrayIfNeeded, function (suggested) {
|
|
58
|
+
return suggested.map(function (config, i) { return (__assign(__assign({}, config), { id: requestConfig_1.suggested[i] })); });
|
|
59
|
+
}), ramda_1.always([]))(suggested));
|
|
55
60
|
var request = ramda_1.cond([
|
|
56
61
|
[ramda_1.pipe(ramda_1.prop('uri'), mdm_sdk_1.isTempUri), function () { return Promise.resolve([{ total: 0 }]); }],
|
|
57
62
|
[
|
|
@@ -59,14 +64,14 @@ var useRelationsLoader = function (_a) {
|
|
|
59
64
|
function (entity) {
|
|
60
65
|
return mdm_sdk_1.getRelationsForDataTenantEntity({
|
|
61
66
|
entityUri: entity.uri,
|
|
62
|
-
configs:
|
|
67
|
+
configs: configs_1,
|
|
63
68
|
customerTenant: tenant,
|
|
64
69
|
dataTenant: entity.dataTenant,
|
|
65
70
|
dtssPath: dtssPath
|
|
66
71
|
});
|
|
67
72
|
}
|
|
68
73
|
],
|
|
69
|
-
[ramda_1.T, function (entity) { return mdm_sdk_1.getRelationsForEntity(entity.uri,
|
|
74
|
+
[ramda_1.T, function (entity) { return mdm_sdk_1.getRelationsForEntity(entity.uri, configs_1); }]
|
|
70
75
|
]);
|
|
71
76
|
setIsLoading(true);
|
|
72
77
|
safePromise(request(entity))
|
package/esm/components/attributes/editMode/SimpleAttributeEditor/selectors/helpers/parents.js
CHANGED
|
@@ -14,10 +14,11 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
|
14
14
|
to[j] = from[i];
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
|
-
import { uniq } from 'ramda';
|
|
17
|
+
import { defaultTo, isNil, map, path, pipe, prepend, reject, uniq } from 'ramda';
|
|
18
18
|
import mdmModule from '@reltio/mdm-module';
|
|
19
|
-
import { filterRelatedParentValuesForDependentLookupValueUri } from '@reltio/mdm-sdk';
|
|
19
|
+
import { areOneHierarchyUris, filterRelatedParentValuesForDependentLookupValueUri, getAttributeValuePath, getBaseUri } from '@reltio/mdm-sdk';
|
|
20
20
|
export var getParents = function (state, valueUri, node) {
|
|
21
|
+
var _a;
|
|
21
22
|
var parentNodesValues = node.parents.flatMap(function (type) {
|
|
22
23
|
var parentNode = mdmModule.selectors.getDependentLookupsStructureNode(state, type);
|
|
23
24
|
return parentNode.values.map(function (value) { return (__assign(__assign({}, value), { type: type, dependentLookupCode: parentNode.attrType.dependentLookupCode })); });
|
|
@@ -25,6 +26,7 @@ export var getParents = function (state, valueUri, node) {
|
|
|
25
26
|
var modifiedEntities = mdmModule.selectors.getModifiedEntities(state);
|
|
26
27
|
var entityUri = mdmModule.selectors.getEntityUri(state);
|
|
27
28
|
var connections = mdmModule.selectors.getAllRelationsToAddAndEdit(state);
|
|
29
|
+
var metadata = mdmModule.selectors.getMetadata(state);
|
|
28
30
|
var ownParentNodesValues = filterRelatedParentValuesForDependentLookupValueUri({
|
|
29
31
|
parentValues: parentNodesValues,
|
|
30
32
|
valueUri: valueUri,
|
|
@@ -32,8 +34,16 @@ export var getParents = function (state, valueUri, node) {
|
|
|
32
34
|
modifiedEntities: modifiedEntities,
|
|
33
35
|
connections: connections
|
|
34
36
|
});
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
+
var possibleParentBaseTypeUris = pipe(getAttributeValuePath, defaultTo([]), map(pipe(path(['valueType', 'uri']), getBaseUri)), prepend((_a = modifiedEntities[entityUri]) === null || _a === void 0 ? void 0 : _a.type), reject(isNil), uniq)({
|
|
38
|
+
entityUri: entityUri,
|
|
39
|
+
entitiesMap: modifiedEntities,
|
|
40
|
+
connections: connections,
|
|
41
|
+
metadata: metadata
|
|
42
|
+
}, valueUri);
|
|
43
|
+
var neededParentsAttributeTypes = node.parents
|
|
44
|
+
.filter(function (typeUri) { return possibleParentBaseTypeUris.some(areOneHierarchyUris(typeUri)); })
|
|
45
|
+
.map(function (typeUri) {
|
|
46
|
+
var parentNode = mdmModule.selectors.getDependentLookupsStructureNode(state, typeUri);
|
|
37
47
|
return parentNode.attrType;
|
|
38
48
|
});
|
|
39
49
|
var missedParentsAttributeTypes = neededParentsAttributeTypes.filter(function (attrType) { return !ownParentNodesValues.some(function (_a) {
|
|
@@ -13,14 +13,14 @@ var HistoryGraph = function (_a) {
|
|
|
13
13
|
var historyLanes = graphData.historyLanes, rows = graphData.rows;
|
|
14
14
|
var rowPositions = [ROW_MARGIN];
|
|
15
15
|
var _b = rows.reduce(function (acc, _a, i) {
|
|
16
|
-
var uri = _a.uri, height = _a.height, uris = _a.uris, type = _a.type, index = _a.index;
|
|
16
|
+
var uri = _a.uri, height = _a.height, uris = _a.uris, type = _a.type, fakeType = _a.fakeType, index = _a.index;
|
|
17
17
|
var x = historyLanes[uri].index * COL_WIDTH + COL_MARGIN;
|
|
18
18
|
var y = rowPositions[i];
|
|
19
19
|
rowPositions.push(y + height);
|
|
20
|
-
var
|
|
21
|
-
var circleUri =
|
|
20
|
+
var hasFakeType = isFakeHistoryType(fakeType);
|
|
21
|
+
var circleUri = hasFakeType ? uris[0] : uri;
|
|
22
22
|
var isCollapsed = !(uris === null || uris === void 0 ? void 0 : uris.some(function (uri) { return historyLanes[uri]; }));
|
|
23
|
-
acc.circles.push(React.createElement(HistoryCircle, { key: "circle-" + circleUri + "-" + i, x: x, y: y, color: getContributorColor(circleUri), isDashed:
|
|
23
|
+
acc.circles.push(React.createElement(HistoryCircle, { key: "circle-" + circleUri + "-" + i, x: x, y: y, color: getContributorColor(circleUri), isDashed: hasFakeType, isCollapsed: isCollapsed, showCollapseIcon: !!uris, showLine: fakeType === HistoryChangeTypes.FAKE_NAVIGATE_PROFILE }));
|
|
24
24
|
acc.rowLines.push(React.createElement("rect", { key: circleUri + "-" + index, x: x, y: y - ROW_HEIGHT / 2, width: '100%', height: ROW_HEIGHT, fill: getContributorColor(circleUri), opacity: 0.06 }));
|
|
25
25
|
var isUpRight = type === HistoryChangeTypes.ENTITIES_SPLITTED;
|
|
26
26
|
uris === null || uris === void 0 ? void 0 : uris.forEach(function (contributorUri) {
|
|
@@ -31,7 +31,7 @@ var HistoryGraph = function (_a) {
|
|
|
31
31
|
var toX = contributorLane.index * COL_WIDTH + COL_MARGIN;
|
|
32
32
|
var toY = isUpRight ? y - rowHeight : y + rowHeight;
|
|
33
33
|
if (x !== toX)
|
|
34
|
-
acc.links.push(React.createElement(HistoryLink, { key: "link-" + contributorUri + "-" + index, x: x, y: y, toX: toX, toY: toY, isDashed: isFakeHistoryType(
|
|
34
|
+
acc.links.push(React.createElement(HistoryLink, { key: "link-" + contributorUri + "-" + index, x: x, y: y, toX: toX, toY: toY, isDashed: isFakeHistoryType(fakeType), color: getContributorColor(contributorUri) }));
|
|
35
35
|
});
|
|
36
36
|
return acc;
|
|
37
37
|
}, { links: [], circles: [], rowLines: [] }), links = _b.links, rowLines = _b.rowLines, circles = _b.circles;
|
|
@@ -45,13 +45,18 @@ var HistoryGraph = function (_a) {
|
|
|
45
45
|
var start = _a.start, end = _a.end;
|
|
46
46
|
if (((_b = rows[end === null || end === void 0 ? void 0 : end.index]) === null || _b === void 0 ? void 0 : _b.type) === HistoryChangeTypes.ENTITIES_SPLITTED)
|
|
47
47
|
return;
|
|
48
|
-
var
|
|
49
|
-
var
|
|
48
|
+
var startIndex = (start === null || start === void 0 ? void 0 : start.type) === HistoryChangeTypes.ENTITIES_SPLITTED ? (start === null || start === void 0 ? void 0 : start.index) - 1 : start === null || start === void 0 ? void 0 : start.index;
|
|
49
|
+
var endIndex = (end === null || end === void 0 ? void 0 : end.type) === HistoryChangeTypes.ENTITIES_MERGED_MANUALLY ||
|
|
50
|
+
(end === null || end === void 0 ? void 0 : end.type) === HistoryChangeTypes.ENTITIES_MERGED
|
|
51
|
+
? (end === null || end === void 0 ? void 0 : end.index) + 1
|
|
52
|
+
: end === null || end === void 0 ? void 0 : end.index;
|
|
53
|
+
var startY = rowPositions[startIndex] || rowPositions[rowPositions.length - 2];
|
|
54
|
+
var endY = rowPositions[endIndex] || ROW_MARGIN;
|
|
50
55
|
var color = getContributorColor(contributorUri);
|
|
51
56
|
if (!end && contributorLane.index > 0) {
|
|
52
57
|
circles.push(React.createElement(HistoryCircle, { key: "initCircle-" + contributorUri + "-" + i, x: x, y: endY, color: color, showLine: true }));
|
|
53
58
|
}
|
|
54
|
-
links.
|
|
59
|
+
links.unshift(React.createElement("path", { key: "line-" + contributorUri + "-" + i, d: "M" + x + " " + startY + " L" + x + " " + endY, stroke: color, strokeWidth: 2 }));
|
|
55
60
|
});
|
|
56
61
|
});
|
|
57
62
|
return (React.createElement("svg", { className: "chart", width: width, height: height },
|
|
@@ -10,50 +10,49 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { useMemo } from 'react';
|
|
13
|
-
import { isNil, pipe, slice,
|
|
13
|
+
import { isNil, pipe, slice, find, curry, drop } from 'ramda';
|
|
14
14
|
import { HistoryChangeTypes } from './../types';
|
|
15
15
|
export var useHistoryTree = function (_a) {
|
|
16
16
|
var entityUri = _a.entityUri, historyChanges = _a.historyChanges, selectedUris = _a.selectedUris;
|
|
17
17
|
return useMemo(function () {
|
|
18
18
|
var _a;
|
|
19
19
|
var historyLanes = (_a = {}, _a[entityUri] = { index: 0, lifeTime: [] }, _a);
|
|
20
|
-
var rows = [
|
|
21
|
-
|
|
22
|
-
];
|
|
23
|
-
var checkChange = curry(function (involvedUris, change) {
|
|
20
|
+
var rows = [{ user: '', timestamp: 0, uri: entityUri }];
|
|
21
|
+
var checkChange = curry(function (involvedUris, checkInUris, change) {
|
|
24
22
|
var _a;
|
|
25
23
|
var uri = change.uri || entityUri;
|
|
26
|
-
if (
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
if (involvedUris) {
|
|
25
|
+
if (Array.isArray(involvedUris)) {
|
|
26
|
+
if (change.type !== HistoryChangeTypes.ENTITY_LOST_MERGE)
|
|
27
|
+
return null;
|
|
28
|
+
if (involvedUris.includes(uri)) {
|
|
29
|
+
return change;
|
|
30
|
+
}
|
|
31
|
+
else if (checkInUris && change.uris) {
|
|
32
|
+
return involvedUris.some(function (involvedUri) { return change.uris.includes(involvedUri); }) ? change : null;
|
|
33
|
+
}
|
|
31
34
|
}
|
|
32
|
-
else
|
|
33
|
-
|
|
35
|
+
else {
|
|
36
|
+
if (uri === involvedUris || (checkInUris && ((_a = change.uris) === null || _a === void 0 ? void 0 : _a.includes(involvedUris))))
|
|
37
|
+
return change;
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
|
-
else {
|
|
37
|
-
if (uri === involvedUris || ((_a = change.uris) === null || _a === void 0 ? void 0 : _a.includes(involvedUris)))
|
|
38
|
-
return change;
|
|
39
|
-
}
|
|
40
40
|
return null;
|
|
41
41
|
});
|
|
42
|
-
var findNextChange = function (index, involvedUris) {
|
|
43
|
-
return pipe(
|
|
42
|
+
var findNextChange = function (index, involvedUris, checkInUris) {
|
|
43
|
+
return pipe(drop(index + 1), find(checkChange(involvedUris, checkInUris)))(historyChanges);
|
|
44
44
|
};
|
|
45
45
|
var findPreviousChange = function (index, uri) {
|
|
46
|
-
return pipe(slice(index + 1, Infinity), find(checkChange(uri)))(rows);
|
|
46
|
+
return pipe(slice(index + 1, Infinity), find(checkChange(uri, false)))(rows);
|
|
47
47
|
};
|
|
48
48
|
var checkLaneUri = function (uri) {
|
|
49
|
-
|
|
50
|
-
if (!contributorLane && (!selectedUris || selectedUris.includes(uri))) {
|
|
49
|
+
if (!historyLanes[uri] && (!selectedUris || selectedUris.includes(uri))) {
|
|
51
50
|
historyLanes[uri] = {
|
|
52
51
|
index: Object.keys(historyLanes).length,
|
|
53
52
|
lifeTime: []
|
|
54
53
|
};
|
|
55
54
|
}
|
|
56
|
-
return
|
|
55
|
+
return historyLanes[uri];
|
|
57
56
|
};
|
|
58
57
|
var startNewLife = function (lifeTime, change) {
|
|
59
58
|
var currentLife = lifeTime[lifeTime.length - 1];
|
|
@@ -110,11 +109,12 @@ export var useHistoryTree = function (_a) {
|
|
|
110
109
|
? startNewLife(relatedLane.lifeTime, change)
|
|
111
110
|
: endLife(relatedLane.lifeTime, change);
|
|
112
111
|
rows.push({
|
|
113
|
-
type: lifeTimeLength
|
|
114
|
-
? HistoryChangeTypes.FAKE_UPDATE
|
|
115
|
-
: HistoryChangeTypes.FAKE_NAVIGATE_PROFILE,
|
|
116
112
|
uri: uri,
|
|
117
113
|
user: change.user,
|
|
114
|
+
type: change.type,
|
|
115
|
+
fakeType: lifeTimeLength
|
|
116
|
+
? HistoryChangeTypes.FAKE_UPDATE
|
|
117
|
+
: HistoryChangeTypes.FAKE_NAVIGATE_PROFILE,
|
|
118
118
|
timestamp: change.timestamp
|
|
119
119
|
});
|
|
120
120
|
});
|
|
@@ -135,13 +135,13 @@ export var useHistoryTree = function (_a) {
|
|
|
135
135
|
var _a;
|
|
136
136
|
switch (change.type) {
|
|
137
137
|
case HistoryChangeTypes.ENTITIES_SPLITTED:
|
|
138
|
-
if (!findNextChange(index, change.uri || entityUri)) {
|
|
138
|
+
if (!findNextChange(index, change.uri || entityUri, false)) {
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
141
|
else {
|
|
142
142
|
var uri = change.uri;
|
|
143
143
|
var involvedUris = change.uris ? [change.uris, uri] : [uri];
|
|
144
|
-
var lostMergeChange = findNextChange(index, involvedUris);
|
|
144
|
+
var lostMergeChange = findNextChange(index, involvedUris, true);
|
|
145
145
|
if (lostMergeChange && (!uri || uri === lostMergeChange.uri))
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
@@ -191,9 +191,10 @@ export var useHistoryTree = function (_a) {
|
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
193
|
var fakeChange = {
|
|
194
|
-
|
|
194
|
+
fakeType: fakeType,
|
|
195
195
|
uri: postChange.uri,
|
|
196
196
|
uris: [contributorUri],
|
|
197
|
+
type: type,
|
|
197
198
|
user: user,
|
|
198
199
|
timestamp: timestamp
|
|
199
200
|
};
|
|
@@ -162,7 +162,7 @@ export var useCollaboration = function (_a) {
|
|
|
162
162
|
}
|
|
163
163
|
setCommentsMap(function (prevCommentsMap) {
|
|
164
164
|
var _a;
|
|
165
|
-
return (__assign(__assign({}, prevCommentsMap), (_a = {}, _a[uri] = prevCommentsMap[uri].map(function (comment) {
|
|
165
|
+
return (__assign(__assign({}, prevCommentsMap), (_a = {}, _a[uri] = (prevCommentsMap[uri] || []).map(function (comment) {
|
|
166
166
|
if (comment.commentId === commentId) {
|
|
167
167
|
return __assign(__assign({}, comment), { status: newStatus, replies: comment.replies + 1 });
|
|
168
168
|
}
|
|
@@ -11,11 +11,12 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
13
13
|
import { useDispatch, useSelector } from 'react-redux';
|
|
14
|
-
import { cond, pipe, prop, T } from 'ramda';
|
|
14
|
+
import { cond, pipe, prop, T, when, identity, times, length, ifElse, always } from 'ramda';
|
|
15
15
|
import mdm, { profile } from '@reltio/mdm-module';
|
|
16
|
-
import { ActivityFilter, addGlobalFilterToQuery, getRelationsForDataTenantEntity, getRelationsForEntity, isDataTenantEntity, isTempUri, Mode } from '@reltio/mdm-sdk';
|
|
16
|
+
import { ActivityFilter, addGlobalFilterToQuery, getRelationsForDataTenantEntity, getRelationsForEntity, isDataTenantEntity, isTempUri, Mode, wrapInArrayIfNeeded } from '@reltio/mdm-sdk';
|
|
17
17
|
import { useSafePromise } from './useSafePromise';
|
|
18
18
|
import { usePrevious } from './usePrevious';
|
|
19
|
+
var buildSuggestedIds = when(identity, pipe(wrapInArrayIfNeeded, length, times(function (n) { return n + 1; })));
|
|
19
20
|
export var useRelationsLoader = function (_a) {
|
|
20
21
|
var sorting = _a.sorting, filter = _a.filter, page = _a.page, rowsPerPage = _a.rowsPerPage, config = _a.config, entity = _a.entity, relationActivityFilter = _a.relationActivityFilter, mode = _a.mode;
|
|
21
22
|
var _b = useState(false), isLoading = _b[0], setIsLoading = _b[1];
|
|
@@ -24,12 +25,16 @@ export var useRelationsLoader = function (_a) {
|
|
|
24
25
|
var dtssPath = useSelector(mdm.selectors.getDtssPath);
|
|
25
26
|
var _c = useSelector(mdm.selectors.getGlobalSearchRequestOptions) || {}, activityFilter = _c.activityFilter, globalFilter = _c.globalFilter;
|
|
26
27
|
var safePromise = useSafePromise();
|
|
28
|
+
var suggested = config.suggested;
|
|
27
29
|
var loadRelations = useCallback(function () {
|
|
28
30
|
if (entity === null || entity === void 0 ? void 0 : entity.uri) {
|
|
29
31
|
var requestConfig_1 = __assign(__assign({}, config.content), { sortBy: sorting === null || sorting === void 0 ? void 0 : sorting.field, order: sorting === null || sorting === void 0 ? void 0 : sorting.order, returnDates: true, returnObjects: true, activeness: {
|
|
30
32
|
relation: relationActivityFilter || ActivityFilter.ALL,
|
|
31
33
|
entity: activityFilter
|
|
32
|
-
}, max: rowsPerPage, offset: page * rowsPerPage, filter: addGlobalFilterToQuery(globalFilter, filter) || undefined });
|
|
34
|
+
}, max: rowsPerPage, offset: page * rowsPerPage, filter: addGlobalFilterToQuery(globalFilter, filter) || undefined, suggested: buildSuggestedIds(suggested) });
|
|
35
|
+
var configs_1 = [requestConfig_1].concat(ifElse(identity, pipe(wrapInArrayIfNeeded, function (suggested) {
|
|
36
|
+
return suggested.map(function (config, i) { return (__assign(__assign({}, config), { id: requestConfig_1.suggested[i] })); });
|
|
37
|
+
}), always([]))(suggested));
|
|
33
38
|
var request = cond([
|
|
34
39
|
[pipe(prop('uri'), isTempUri), function () { return Promise.resolve([{ total: 0 }]); }],
|
|
35
40
|
[
|
|
@@ -37,14 +42,14 @@ export var useRelationsLoader = function (_a) {
|
|
|
37
42
|
function (entity) {
|
|
38
43
|
return getRelationsForDataTenantEntity({
|
|
39
44
|
entityUri: entity.uri,
|
|
40
|
-
configs:
|
|
45
|
+
configs: configs_1,
|
|
41
46
|
customerTenant: tenant,
|
|
42
47
|
dataTenant: entity.dataTenant,
|
|
43
48
|
dtssPath: dtssPath
|
|
44
49
|
});
|
|
45
50
|
}
|
|
46
51
|
],
|
|
47
|
-
[T, function (entity) { return getRelationsForEntity(entity.uri,
|
|
52
|
+
[T, function (entity) { return getRelationsForEntity(entity.uri, configs_1); }]
|
|
48
53
|
]);
|
|
49
54
|
setIsLoading(true);
|
|
50
55
|
safePromise(request(entity))
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.973",
|
|
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.
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
10
|
+
"@reltio/mdm-module": "^1.4.973",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.973",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|