@reltio/components 1.4.969 → 1.4.970
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/hooks/useCollaboration.js +1 -1
- package/cjs/hooks/useRelationsLoader.d.ts +1 -0
- package/cjs/hooks/useRelationsLoader.js +8 -3
- 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
|
@@ -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))
|
|
@@ -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.970",
|
|
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.970",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.970",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|