@reltio/components 1.4.1498 → 1.4.1500
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/ProfileBandNavigation/helpers/index.js +16 -12
- package/cjs/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +2 -1
- package/esm/components/ProfileBandNavigation/helpers/index.js +16 -12
- package/esm/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +4 -3
- package/package.json +3 -3
|
@@ -43,24 +43,28 @@ var replaceWithWinnerUri = function (searchNavigationData, winnerUri) {
|
|
|
43
43
|
}
|
|
44
44
|
return searchNavigationData;
|
|
45
45
|
};
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
var removeLosersUris = function (searchNavigationData, losersUris) {
|
|
47
|
+
var _a = searchNavigationData.cache, cache = _a === void 0 ? [] : _a, index = searchNavigationData.index, total = searchNavigationData.total, uri = searchNavigationData.uri;
|
|
48
|
+
var losersInCache = losersUris.filter(function (uri) { return cache.includes(uri); });
|
|
49
|
+
if (losersInCache.length === 0) {
|
|
50
|
+
return searchNavigationData;
|
|
51
|
+
}
|
|
52
|
+
var updatedTotal = total - losersInCache.length;
|
|
53
|
+
var uriIndex = cache.indexOf(uri);
|
|
54
|
+
var updatedIndex = index;
|
|
55
|
+
for (var _i = 0, losersInCache_1 = losersInCache; _i < losersInCache_1.length; _i++) {
|
|
56
|
+
var loser = losersInCache_1[_i];
|
|
57
|
+
var loserIndex = cache.indexOf(loser);
|
|
54
58
|
if (loserIndex < uriIndex) {
|
|
55
|
-
|
|
59
|
+
updatedIndex--;
|
|
56
60
|
}
|
|
57
|
-
return __assign(__assign({}, searchNavigationData), { total: total - 1, cache: cache, index: index });
|
|
58
61
|
}
|
|
59
|
-
return
|
|
62
|
+
var updatedCache = cache.filter(function (uri) { return !losersInCache.includes(uri); });
|
|
63
|
+
return __assign(__assign({}, searchNavigationData), { cache: updatedCache, index: updatedIndex, total: updatedTotal });
|
|
60
64
|
};
|
|
61
65
|
var applyMergeToSearchNavigationData = function (searchNavigationData, payload) {
|
|
62
66
|
var winnerUri = payload.winnerUri, _a = payload.losersUris, losersUris = _a === void 0 ? [] : _a;
|
|
63
67
|
var updatedSearchNavigationData = replaceWithWinnerUri(searchNavigationData, winnerUri);
|
|
64
|
-
return
|
|
68
|
+
return removeLosersUris(updatedSearchNavigationData, losersUris);
|
|
65
69
|
};
|
|
66
70
|
exports.applyMergeToSearchNavigationData = applyMergeToSearchNavigationData;
|
|
@@ -110,8 +110,9 @@ var SimpleAttributeEditor = function (_a) {
|
|
|
110
110
|
var showDeleteButton = !deleted && !!onDeleteAttribute && canDelete;
|
|
111
111
|
var hasError = !!errorMessage;
|
|
112
112
|
var deletedProps = deleted ? { disabled: true } : {};
|
|
113
|
+
var isProfilePerspectiveView = (0, react_1.useContext)(contexts_1.ProfilePerspectiveViewContext);
|
|
113
114
|
var autopopulationContextValue = (0, useAutopopulationContextValue_1.useAutopopulationContextValue)({
|
|
114
|
-
enabled:
|
|
115
|
+
enabled: isProfilePerspectiveView && (0, mdm_sdk_1.isDependentLookupAttrType)(attributeType),
|
|
115
116
|
attributeTypeUri: attributeType === null || attributeType === void 0 ? void 0 : attributeType.uri,
|
|
116
117
|
valueUri: attributeValue.uri
|
|
117
118
|
}).autopopulationContextValue;
|
|
@@ -40,23 +40,27 @@ var replaceWithWinnerUri = function (searchNavigationData, winnerUri) {
|
|
|
40
40
|
}
|
|
41
41
|
return searchNavigationData;
|
|
42
42
|
};
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
var removeLosersUris = function (searchNavigationData, losersUris) {
|
|
44
|
+
var _a = searchNavigationData.cache, cache = _a === void 0 ? [] : _a, index = searchNavigationData.index, total = searchNavigationData.total, uri = searchNavigationData.uri;
|
|
45
|
+
var losersInCache = losersUris.filter(function (uri) { return cache.includes(uri); });
|
|
46
|
+
if (losersInCache.length === 0) {
|
|
47
|
+
return searchNavigationData;
|
|
48
|
+
}
|
|
49
|
+
var updatedTotal = total - losersInCache.length;
|
|
50
|
+
var uriIndex = cache.indexOf(uri);
|
|
51
|
+
var updatedIndex = index;
|
|
52
|
+
for (var _i = 0, losersInCache_1 = losersInCache; _i < losersInCache_1.length; _i++) {
|
|
53
|
+
var loser = losersInCache_1[_i];
|
|
54
|
+
var loserIndex = cache.indexOf(loser);
|
|
51
55
|
if (loserIndex < uriIndex) {
|
|
52
|
-
|
|
56
|
+
updatedIndex--;
|
|
53
57
|
}
|
|
54
|
-
return __assign(__assign({}, searchNavigationData), { total: total - 1, cache: cache, index: index });
|
|
55
58
|
}
|
|
56
|
-
return
|
|
59
|
+
var updatedCache = cache.filter(function (uri) { return !losersInCache.includes(uri); });
|
|
60
|
+
return __assign(__assign({}, searchNavigationData), { cache: updatedCache, index: updatedIndex, total: updatedTotal });
|
|
57
61
|
};
|
|
58
62
|
export var applyMergeToSearchNavigationData = function (searchNavigationData, payload) {
|
|
59
63
|
var winnerUri = payload.winnerUri, _a = payload.losersUris, losersUris = _a === void 0 ? [] : _a;
|
|
60
64
|
var updatedSearchNavigationData = replaceWithWinnerUri(searchNavigationData, winnerUri);
|
|
61
|
-
return
|
|
65
|
+
return removeLosersUris(updatedSearchNavigationData, losersUris);
|
|
62
66
|
};
|
|
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
-
import React, { useCallback, useMemo } from 'react';
|
|
23
|
+
import React, { useCallback, useContext, useMemo } from 'react';
|
|
24
24
|
import PropTypes from 'prop-types';
|
|
25
25
|
import { useSelector } from 'react-redux';
|
|
26
26
|
import classnames from 'classnames';
|
|
@@ -38,7 +38,7 @@ import { attributeValueToEditorValue, prepareChangeData } from './utils';
|
|
|
38
38
|
import withAsyncMount from '../../../../HOCs/withAsyncMount/withAsyncMount';
|
|
39
39
|
import { getDependentLookupEditorContext } from './selectors/getDependentLookupEditorContext';
|
|
40
40
|
import { withContext } from '../../../../HOCs';
|
|
41
|
-
import { ScrollToErrorContext, DependentLookupAutopopulationContext } from '../../../../contexts';
|
|
41
|
+
import { ScrollToErrorContext, DependentLookupAutopopulationContext, ProfilePerspectiveViewContext } from '../../../../contexts';
|
|
42
42
|
import { useScrollToAttributeError } from '../../../../hooks';
|
|
43
43
|
import { useAutopopulationContextValue } from './useAutopopulationContextValue';
|
|
44
44
|
import { useStyles } from './styles';
|
|
@@ -82,8 +82,9 @@ var SimpleAttributeEditor = function (_a) {
|
|
|
82
82
|
var showDeleteButton = !deleted && !!onDeleteAttribute && canDelete;
|
|
83
83
|
var hasError = !!errorMessage;
|
|
84
84
|
var deletedProps = deleted ? { disabled: true } : {};
|
|
85
|
+
var isProfilePerspectiveView = useContext(ProfilePerspectiveViewContext);
|
|
85
86
|
var autopopulationContextValue = useAutopopulationContextValue({
|
|
86
|
-
enabled:
|
|
87
|
+
enabled: isProfilePerspectiveView && isDependentLookupAttrType(attributeType),
|
|
87
88
|
attributeTypeUri: attributeType === null || attributeType === void 0 ? void 0 : attributeType.uri,
|
|
88
89
|
valueUri: attributeValue.uri
|
|
89
90
|
}).autopopulationContextValue;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1500",
|
|
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.1500",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1500",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|