@reltio/components 1.4.1985 → 1.4.1987
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/MatchRulesSelector/MatchRulesSelector.d.ts +3 -3
- package/cjs/MatchRulesSelector/MatchRulesSelector.js +9 -2
- package/cjs/MatchRulesSelector/MatchRulesSelector.test.js +114 -33
- package/cjs/SimpleAttribute/SimpleAttribute.test.js +2 -2
- package/cjs/hooks/useMaskedAttribute/useMaskedAttribute.d.ts +3 -3
- package/cjs/hooks/useMaskedAttribute/useMaskedAttribute.js +3 -1
- package/esm/MatchRulesSelector/MatchRulesSelector.d.ts +3 -3
- package/esm/MatchRulesSelector/MatchRulesSelector.js +10 -3
- package/esm/MatchRulesSelector/MatchRulesSelector.test.js +114 -33
- package/esm/SimpleAttribute/SimpleAttribute.test.js +2 -2
- package/esm/hooks/useMaskedAttribute/useMaskedAttribute.d.ts +3 -3
- package/esm/hooks/useMaskedAttribute/useMaskedAttribute.js +3 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { MatchRulesAttrNames } from '@reltio/mdm-sdk';
|
|
3
3
|
import { TextFieldProps as TextFieldPropsType } from '@mui/material/TextField';
|
|
4
4
|
type Props = {
|
|
5
5
|
name: MatchRulesAttrNames;
|
|
@@ -7,7 +7,7 @@ type Props = {
|
|
|
7
7
|
onChange: (values: string[]) => void;
|
|
8
8
|
TextFieldProps?: Partial<TextFieldPropsType>;
|
|
9
9
|
fullWidth?: boolean;
|
|
10
|
-
|
|
10
|
+
entityTypeUris?: string[];
|
|
11
11
|
};
|
|
12
|
-
export declare const MatchRulesSelector: ({ name, values, onChange,
|
|
12
|
+
export declare const MatchRulesSelector: ({ name, values, onChange, entityTypeUris, TextFieldProps, fullWidth }: Props) => React.JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -36,9 +36,16 @@ var prepareOptions = function (options) {
|
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
38
|
var MatchRulesSelector = function (_a) {
|
|
39
|
-
var name = _a.name, values = _a.values, onChange = _a.onChange,
|
|
39
|
+
var name = _a.name, values = _a.values, onChange = _a.onChange, entityTypeUris = _a.entityTypeUris, TextFieldProps = _a.TextFieldProps, fullWidth = _a.fullWidth;
|
|
40
40
|
var metadata = (0, MdmModuleContext_1.useMdmMetadata)();
|
|
41
|
-
var _b = (0, react_1.useMemo)(function () {
|
|
41
|
+
var _b = (0, react_1.useMemo)(function () {
|
|
42
|
+
var allEntityTypeUris = metadata.entityTypes.filter(mdm_sdk_1.isAvailableEntityType).map(function (_a) {
|
|
43
|
+
var uri = _a.uri;
|
|
44
|
+
return uri;
|
|
45
|
+
});
|
|
46
|
+
var displayedEntityTypeUris = entityTypeUris.length ? entityTypeUris : allEntityTypeUris;
|
|
47
|
+
return (0, mdm_sdk_1.partitionByMlMatch)(displayedEntityTypeUris.flatMap(function (entityTypeUri) { return (0, mdm_sdk_1.getMatchGroups)(metadata, entityTypeUri); }));
|
|
48
|
+
}, [entityTypeUris, metadata]), mlMatchRules = _b[0], matchRules = _b[1];
|
|
42
49
|
var options = (0, react_1.useMemo)(function () { return prepareOptions(name === mdm_sdk_1.MatchRulesAttrNames.matchRules ? matchRules : mlMatchRules); }, [name, matchRules, mlMatchRules]);
|
|
43
50
|
return (react_1.default.createElement(MultiValueSelector_1.MultiValueSelector, { values: values, onChange: onChange, options: options, TextFieldProps: TextFieldProps, fullWidth: fullWidth }));
|
|
44
51
|
};
|
|
@@ -56,39 +56,66 @@ var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
|
56
56
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
57
57
|
var MatchRulesSelector_1 = require("./MatchRulesSelector");
|
|
58
58
|
var MdmModuleContext_1 = require("../contexts/MdmModuleContext");
|
|
59
|
-
var matchGroups = [
|
|
60
|
-
{
|
|
61
|
-
label: 'matchRule1',
|
|
62
|
-
uri: 'configuration/entityTypes/HCA/matchGroups/HCAByUWI'
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
label: 'MLmatchRule1',
|
|
66
|
-
uri: 'configuration/entityTypes/HCA/matchGroups/HCAMLMatchGroup',
|
|
67
|
-
scope: 'INTERNAL',
|
|
68
|
-
matchMethod: 'match_iq'
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
label: 'matchRule2',
|
|
72
|
-
uri: 'configuration/entityTypes/HCA/matchGroups/HCABytsv'
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
label: 'MLmatchRule2',
|
|
76
|
-
uri: 'configuration/entityTypes/HCА/matchGroups/HCPSameName',
|
|
77
|
-
scope: 'ALL',
|
|
78
|
-
matchMethod: 'match_iq'
|
|
79
|
-
}
|
|
80
|
-
];
|
|
81
59
|
var metadata = {
|
|
82
|
-
entityTypes: [
|
|
60
|
+
entityTypes: [
|
|
61
|
+
{
|
|
62
|
+
uri: 'configuration/entityTypes/HCA',
|
|
63
|
+
label: 'HCA',
|
|
64
|
+
matchGroups: [
|
|
65
|
+
{
|
|
66
|
+
label: 'HCA Match Rule 1',
|
|
67
|
+
uri: 'configuration/entityTypes/HCA/matchGroups/HCAByUWI'
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
label: 'HCA ML Match Rule 1',
|
|
71
|
+
uri: 'configuration/entityTypes/HCA/matchGroups/HCAMLMatchGroup',
|
|
72
|
+
scope: 'INTERNAL',
|
|
73
|
+
matchMethod: 'match_iq'
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: 'HCA Match Rule 2',
|
|
77
|
+
uri: 'configuration/entityTypes/HCA/matchGroups/HCABytsv'
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
label: 'HCA ML Match Rule 2',
|
|
81
|
+
uri: 'configuration/entityTypes/HCА/matchGroups/HCPSameName',
|
|
82
|
+
scope: 'ALL',
|
|
83
|
+
matchMethod: 'match_iq'
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
uri: 'configuration/entityTypes/HCP',
|
|
89
|
+
label: 'HCP',
|
|
90
|
+
matchGroups: [
|
|
91
|
+
{
|
|
92
|
+
label: 'HCP Match Rule 1',
|
|
93
|
+
uri: 'configuration/entityTypes/HCP/matchGroups/HCPMatchRule'
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
uri: 'configuration/entityTypes/Individual',
|
|
99
|
+
label: 'Individual',
|
|
100
|
+
matchGroups: [
|
|
101
|
+
{
|
|
102
|
+
label: 'Individual Match Rule 1',
|
|
103
|
+
uri: 'configuration/entityTypes/Individual/matchGroups/IndividualMatchRule'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
label: 'Individual ML Match Rule 1',
|
|
107
|
+
uri: 'configuration/entityTypes/Individual/matchGroups/IndividualMLMatchRule',
|
|
108
|
+
scope: 'INTERNAL',
|
|
109
|
+
matchMethod: 'match_iq'
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
]
|
|
83
114
|
};
|
|
84
115
|
var defaultProps = {
|
|
85
116
|
onChange: jest.fn(),
|
|
86
117
|
name: mdm_sdk_1.MatchRulesAttrNames.matchRules,
|
|
87
|
-
|
|
88
|
-
uri: 'configuration/entityTypes/HCA',
|
|
89
|
-
label: 'HCA',
|
|
90
|
-
attributes: []
|
|
91
|
-
}
|
|
118
|
+
entityTypeUris: ['configuration/entityTypes/HCA']
|
|
92
119
|
};
|
|
93
120
|
var setUp = function (props) {
|
|
94
121
|
if (props === void 0) { props = defaultProps; }
|
|
@@ -100,6 +127,23 @@ var setUp = function (props) {
|
|
|
100
127
|
return __assign(__assign({}, (0, react_2.render)(react_1.default.createElement(MatchRulesSelector_1.MatchRulesSelector, __assign({}, props)), { wrapper: Providers })), { user: user });
|
|
101
128
|
};
|
|
102
129
|
describe('MatchRulesSelector tests', function () {
|
|
130
|
+
it('should show rules for several entity types correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
131
|
+
var props, user;
|
|
132
|
+
return __generator(this, function (_a) {
|
|
133
|
+
switch (_a.label) {
|
|
134
|
+
case 0:
|
|
135
|
+
props = __assign(__assign({}, defaultProps), { entityTypeUris: ['configuration/entityTypes/HCP', 'configuration/entityTypes/Individual'] });
|
|
136
|
+
user = setUp(props).user;
|
|
137
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('combobox'))];
|
|
138
|
+
case 1:
|
|
139
|
+
_a.sent();
|
|
140
|
+
expect(react_2.screen.getAllByRole('option')).toHaveLength(2);
|
|
141
|
+
react_2.screen.getByText('HCP Match Rule 1');
|
|
142
|
+
react_2.screen.getByText('Individual Match Rule 1');
|
|
143
|
+
return [2 /*return*/];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}); });
|
|
103
147
|
it('should show match rules as options correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
104
148
|
var user;
|
|
105
149
|
return __generator(this, function (_a) {
|
|
@@ -110,8 +154,27 @@ describe('MatchRulesSelector tests', function () {
|
|
|
110
154
|
case 1:
|
|
111
155
|
_a.sent();
|
|
112
156
|
expect(react_2.screen.getAllByRole('option')).toHaveLength(2);
|
|
113
|
-
react_2.screen.getByText('
|
|
114
|
-
react_2.screen.getByText('
|
|
157
|
+
react_2.screen.getByText('HCA Match Rule 1');
|
|
158
|
+
react_2.screen.getByText('HCA Match Rule 2');
|
|
159
|
+
return [2 /*return*/];
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}); });
|
|
163
|
+
it('should show match rules as options correctly if entityTypeUris prop is empty array', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
164
|
+
var props, user;
|
|
165
|
+
return __generator(this, function (_a) {
|
|
166
|
+
switch (_a.label) {
|
|
167
|
+
case 0:
|
|
168
|
+
props = __assign(__assign({}, defaultProps), { entityTypeUris: [] });
|
|
169
|
+
user = setUp(props).user;
|
|
170
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('combobox'))];
|
|
171
|
+
case 1:
|
|
172
|
+
_a.sent();
|
|
173
|
+
expect(react_2.screen.getAllByRole('option')).toHaveLength(4);
|
|
174
|
+
react_2.screen.getByText('HCA Match Rule 1');
|
|
175
|
+
react_2.screen.getByText('HCA Match Rule 2');
|
|
176
|
+
react_2.screen.getByText('HCP Match Rule 1');
|
|
177
|
+
react_2.screen.getByText('Individual Match Rule 1');
|
|
115
178
|
return [2 /*return*/];
|
|
116
179
|
}
|
|
117
180
|
});
|
|
@@ -127,8 +190,26 @@ describe('MatchRulesSelector tests', function () {
|
|
|
127
190
|
case 1:
|
|
128
191
|
_a.sent();
|
|
129
192
|
expect(react_2.screen.getAllByRole('option')).toHaveLength(2);
|
|
130
|
-
react_2.screen.getByText('
|
|
131
|
-
react_2.screen.getByText('
|
|
193
|
+
react_2.screen.getByText('HCA ML Match Rule 1');
|
|
194
|
+
react_2.screen.getByText('HCA ML Match Rule 2');
|
|
195
|
+
return [2 /*return*/];
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}); });
|
|
199
|
+
it('should show ml match rules as options correctly if entityTypeUris prop is empty array', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
200
|
+
var props, user;
|
|
201
|
+
return __generator(this, function (_a) {
|
|
202
|
+
switch (_a.label) {
|
|
203
|
+
case 0:
|
|
204
|
+
props = __assign(__assign({}, defaultProps), { name: mdm_sdk_1.MatchRulesAttrNames.MLRecommendedMatch, entityTypeUris: [] });
|
|
205
|
+
user = setUp(props).user;
|
|
206
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('combobox'))];
|
|
207
|
+
case 1:
|
|
208
|
+
_a.sent();
|
|
209
|
+
expect(react_2.screen.getAllByRole('option')).toHaveLength(3);
|
|
210
|
+
react_2.screen.getByText('HCA ML Match Rule 1');
|
|
211
|
+
react_2.screen.getByText('HCA ML Match Rule 2');
|
|
212
|
+
react_2.screen.getByText('Individual ML Match Rule 1');
|
|
132
213
|
return [2 /*return*/];
|
|
133
214
|
}
|
|
134
215
|
});
|
|
@@ -138,7 +219,7 @@ describe('MatchRulesSelector tests', function () {
|
|
|
138
219
|
return __generator(this, function (_a) {
|
|
139
220
|
props = __assign(__assign({}, defaultProps), { values: ['configuration/entityTypes/HCA/matchGroups/HCABytsv'] });
|
|
140
221
|
setUp(props);
|
|
141
|
-
react_2.screen.getByText('
|
|
222
|
+
react_2.screen.getByText('HCA Match Rule 2');
|
|
142
223
|
return [2 /*return*/];
|
|
143
224
|
});
|
|
144
225
|
}); });
|
|
@@ -42,7 +42,7 @@ describe('SimpleAttribute tests', function () {
|
|
|
42
42
|
expect(dataTypeValue.prop('dataTypeDefinition')).toEqual({ type: 'String', uri: 'URI', name: 'Name' });
|
|
43
43
|
});
|
|
44
44
|
it('should provide correct props DataTypeValue if attribute is lookup', function () {
|
|
45
|
-
var attrType = { type: 'String', dependentLookupCode: 'Code', name: 'Name', uri: 'URI', access: [] };
|
|
45
|
+
var attrType = { type: 'String', dependentLookupCode: 'Code', name: 'Name', uri: 'URI', access: ['READ'] };
|
|
46
46
|
var attributeValue = {
|
|
47
47
|
value: '123',
|
|
48
48
|
lookupCode: '12',
|
|
@@ -53,7 +53,7 @@ describe('SimpleAttribute tests', function () {
|
|
|
53
53
|
var dataTypeValue = component.find(DataTypeValue_1.DataTypeValue);
|
|
54
54
|
expect(dataTypeValue.length).toBe(1);
|
|
55
55
|
expect(dataTypeValue.prop('value')).toEqual((0, ramda_1.pick)(['value', 'lookupCode'], attributeValue));
|
|
56
|
-
expect(dataTypeValue.prop('dataTypeDefinition')).toEqual(__assign({ type: 'String', dependentLookupCode: 'Code', uri: 'URI', name: 'Name' }, { type: mdm_sdk_1.DataTypes.TYPE_DEPENDENT_LOOKUP }));
|
|
56
|
+
expect(dataTypeValue.prop('dataTypeDefinition')).toEqual(__assign({ access: ['READ'], type: 'String', dependentLookupCode: 'Code', uri: 'URI', name: 'Name' }, { type: mdm_sdk_1.DataTypes.TYPE_DEPENDENT_LOOKUP }));
|
|
57
57
|
});
|
|
58
58
|
it('should render CommentsContainer inside COMMENTS_CONTAINER_VISIBILITY_AREA with correct uri', function () {
|
|
59
59
|
var attrType = { type: 'String', name: 'Name', uri: 'uri1' };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AttributeTypeForMasking, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
2
2
|
type Props = {
|
|
3
3
|
attributeValue: SimpleAttributeValue;
|
|
4
|
-
attributeType:
|
|
4
|
+
attributeType: AttributeTypeForMasking;
|
|
5
5
|
};
|
|
6
6
|
export declare const useMaskedAttribute: ({ attributeType, attributeValue }: Props) => {
|
|
7
|
-
isUnmaskingNeeded:
|
|
7
|
+
isUnmaskingNeeded: any;
|
|
8
8
|
isMasked: boolean;
|
|
9
9
|
toggleMasking: () => void;
|
|
10
10
|
isUnmasking: boolean;
|
|
@@ -3,14 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useMaskedAttribute = void 0;
|
|
4
4
|
var react_1 = require("react");
|
|
5
5
|
var MdmModuleContext_1 = require("../../contexts/MdmModuleContext");
|
|
6
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
6
7
|
var MaskedAttributesContext_1 = require("../../contexts/MaskedAttributesContext");
|
|
7
8
|
var useMaskedAttribute = function (_a) {
|
|
8
9
|
var attributeType = _a.attributeType, attributeValue = _a.attributeValue;
|
|
9
10
|
var isViewMode = (0, MdmModuleContext_1.useMdmIsViewMode)();
|
|
10
11
|
var unmaskAttributeValue = (0, MaskedAttributesContext_1.useUnmaskAttributeValue)();
|
|
11
12
|
var maskAttributeValue = (0, MaskedAttributesContext_1.useMaskAttributeValue)();
|
|
13
|
+
var canUnmaskAttribute = (0, mdm_sdk_1.checkCanUnmaskAttribute)(attributeType);
|
|
12
14
|
var _b = (0, MaskedAttributesContext_1.useUnmaskedAttributeValue)(attributeValue.uri) || {}, unmaskedAttributeValue = _b.attributeValue, _c = _b.isUnmasked, isUnmasked = _c === void 0 ? false : _c, _d = _b.loading, loading = _d === void 0 ? false : _d;
|
|
13
|
-
var isUnmaskingNeeded = unmaskAttributeValue && maskAttributeValue && !!attributeType.masking && isViewMode;
|
|
15
|
+
var isUnmaskingNeeded = unmaskAttributeValue && maskAttributeValue && !!attributeType.masking && isViewMode && canUnmaskAttribute;
|
|
14
16
|
var unmask = (0, react_1.useCallback)(function () {
|
|
15
17
|
return isUnmaskingNeeded ? unmaskAttributeValue(attributeValue.uri) : Promise.resolve();
|
|
16
18
|
}, [unmaskAttributeValue, attributeValue.uri, isUnmaskingNeeded]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { MatchRulesAttrNames } from '@reltio/mdm-sdk';
|
|
3
3
|
import { TextFieldProps as TextFieldPropsType } from '@mui/material/TextField';
|
|
4
4
|
type Props = {
|
|
5
5
|
name: MatchRulesAttrNames;
|
|
@@ -7,7 +7,7 @@ type Props = {
|
|
|
7
7
|
onChange: (values: string[]) => void;
|
|
8
8
|
TextFieldProps?: Partial<TextFieldPropsType>;
|
|
9
9
|
fullWidth?: boolean;
|
|
10
|
-
|
|
10
|
+
entityTypeUris?: string[];
|
|
11
11
|
};
|
|
12
|
-
export declare const MatchRulesSelector: ({ name, values, onChange,
|
|
12
|
+
export declare const MatchRulesSelector: ({ name, values, onChange, entityTypeUris, TextFieldProps, fullWidth }: Props) => React.JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
-
import { getMatchGroups, partitionByMlMatch, MatchRulesAttrNames } from '@reltio/mdm-sdk';
|
|
2
|
+
import { getMatchGroups, partitionByMlMatch, MatchRulesAttrNames, isAvailableEntityType } from '@reltio/mdm-sdk';
|
|
3
3
|
import { MultiValueSelector } from '../MultiValueSelector';
|
|
4
4
|
import { useMdmMetadata } from '../contexts/MdmModuleContext';
|
|
5
5
|
var prepareOptions = function (options) {
|
|
@@ -10,9 +10,16 @@ var prepareOptions = function (options) {
|
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
export var MatchRulesSelector = function (_a) {
|
|
13
|
-
var name = _a.name, values = _a.values, onChange = _a.onChange,
|
|
13
|
+
var name = _a.name, values = _a.values, onChange = _a.onChange, entityTypeUris = _a.entityTypeUris, TextFieldProps = _a.TextFieldProps, fullWidth = _a.fullWidth;
|
|
14
14
|
var metadata = useMdmMetadata();
|
|
15
|
-
var _b = useMemo(function () {
|
|
15
|
+
var _b = useMemo(function () {
|
|
16
|
+
var allEntityTypeUris = metadata.entityTypes.filter(isAvailableEntityType).map(function (_a) {
|
|
17
|
+
var uri = _a.uri;
|
|
18
|
+
return uri;
|
|
19
|
+
});
|
|
20
|
+
var displayedEntityTypeUris = entityTypeUris.length ? entityTypeUris : allEntityTypeUris;
|
|
21
|
+
return partitionByMlMatch(displayedEntityTypeUris.flatMap(function (entityTypeUri) { return getMatchGroups(metadata, entityTypeUri); }));
|
|
22
|
+
}, [entityTypeUris, metadata]), mlMatchRules = _b[0], matchRules = _b[1];
|
|
16
23
|
var options = useMemo(function () { return prepareOptions(name === MatchRulesAttrNames.matchRules ? matchRules : mlMatchRules); }, [name, matchRules, mlMatchRules]);
|
|
17
24
|
return (React.createElement(MultiValueSelector, { values: values, onChange: onChange, options: options, TextFieldProps: TextFieldProps, fullWidth: fullWidth }));
|
|
18
25
|
};
|
|
@@ -51,39 +51,66 @@ import userEvent from '@testing-library/user-event';
|
|
|
51
51
|
import { MatchRulesAttrNames } from '@reltio/mdm-sdk';
|
|
52
52
|
import { MatchRulesSelector } from './MatchRulesSelector';
|
|
53
53
|
import { MdmModuleProvider } from '../contexts/MdmModuleContext';
|
|
54
|
-
var matchGroups = [
|
|
55
|
-
{
|
|
56
|
-
label: 'matchRule1',
|
|
57
|
-
uri: 'configuration/entityTypes/HCA/matchGroups/HCAByUWI'
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
label: 'MLmatchRule1',
|
|
61
|
-
uri: 'configuration/entityTypes/HCA/matchGroups/HCAMLMatchGroup',
|
|
62
|
-
scope: 'INTERNAL',
|
|
63
|
-
matchMethod: 'match_iq'
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
label: 'matchRule2',
|
|
67
|
-
uri: 'configuration/entityTypes/HCA/matchGroups/HCABytsv'
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
label: 'MLmatchRule2',
|
|
71
|
-
uri: 'configuration/entityTypes/HCА/matchGroups/HCPSameName',
|
|
72
|
-
scope: 'ALL',
|
|
73
|
-
matchMethod: 'match_iq'
|
|
74
|
-
}
|
|
75
|
-
];
|
|
76
54
|
var metadata = {
|
|
77
|
-
entityTypes: [
|
|
55
|
+
entityTypes: [
|
|
56
|
+
{
|
|
57
|
+
uri: 'configuration/entityTypes/HCA',
|
|
58
|
+
label: 'HCA',
|
|
59
|
+
matchGroups: [
|
|
60
|
+
{
|
|
61
|
+
label: 'HCA Match Rule 1',
|
|
62
|
+
uri: 'configuration/entityTypes/HCA/matchGroups/HCAByUWI'
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
label: 'HCA ML Match Rule 1',
|
|
66
|
+
uri: 'configuration/entityTypes/HCA/matchGroups/HCAMLMatchGroup',
|
|
67
|
+
scope: 'INTERNAL',
|
|
68
|
+
matchMethod: 'match_iq'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: 'HCA Match Rule 2',
|
|
72
|
+
uri: 'configuration/entityTypes/HCA/matchGroups/HCABytsv'
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: 'HCA ML Match Rule 2',
|
|
76
|
+
uri: 'configuration/entityTypes/HCА/matchGroups/HCPSameName',
|
|
77
|
+
scope: 'ALL',
|
|
78
|
+
matchMethod: 'match_iq'
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
uri: 'configuration/entityTypes/HCP',
|
|
84
|
+
label: 'HCP',
|
|
85
|
+
matchGroups: [
|
|
86
|
+
{
|
|
87
|
+
label: 'HCP Match Rule 1',
|
|
88
|
+
uri: 'configuration/entityTypes/HCP/matchGroups/HCPMatchRule'
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
uri: 'configuration/entityTypes/Individual',
|
|
94
|
+
label: 'Individual',
|
|
95
|
+
matchGroups: [
|
|
96
|
+
{
|
|
97
|
+
label: 'Individual Match Rule 1',
|
|
98
|
+
uri: 'configuration/entityTypes/Individual/matchGroups/IndividualMatchRule'
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
label: 'Individual ML Match Rule 1',
|
|
102
|
+
uri: 'configuration/entityTypes/Individual/matchGroups/IndividualMLMatchRule',
|
|
103
|
+
scope: 'INTERNAL',
|
|
104
|
+
matchMethod: 'match_iq'
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
]
|
|
78
109
|
};
|
|
79
110
|
var defaultProps = {
|
|
80
111
|
onChange: jest.fn(),
|
|
81
112
|
name: MatchRulesAttrNames.matchRules,
|
|
82
|
-
|
|
83
|
-
uri: 'configuration/entityTypes/HCA',
|
|
84
|
-
label: 'HCA',
|
|
85
|
-
attributes: []
|
|
86
|
-
}
|
|
113
|
+
entityTypeUris: ['configuration/entityTypes/HCA']
|
|
87
114
|
};
|
|
88
115
|
var setUp = function (props) {
|
|
89
116
|
if (props === void 0) { props = defaultProps; }
|
|
@@ -95,6 +122,23 @@ var setUp = function (props) {
|
|
|
95
122
|
return __assign(__assign({}, render(React.createElement(MatchRulesSelector, __assign({}, props)), { wrapper: Providers })), { user: user });
|
|
96
123
|
};
|
|
97
124
|
describe('MatchRulesSelector tests', function () {
|
|
125
|
+
it('should show rules for several entity types correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
126
|
+
var props, user;
|
|
127
|
+
return __generator(this, function (_a) {
|
|
128
|
+
switch (_a.label) {
|
|
129
|
+
case 0:
|
|
130
|
+
props = __assign(__assign({}, defaultProps), { entityTypeUris: ['configuration/entityTypes/HCP', 'configuration/entityTypes/Individual'] });
|
|
131
|
+
user = setUp(props).user;
|
|
132
|
+
return [4 /*yield*/, user.click(screen.getByRole('combobox'))];
|
|
133
|
+
case 1:
|
|
134
|
+
_a.sent();
|
|
135
|
+
expect(screen.getAllByRole('option')).toHaveLength(2);
|
|
136
|
+
screen.getByText('HCP Match Rule 1');
|
|
137
|
+
screen.getByText('Individual Match Rule 1');
|
|
138
|
+
return [2 /*return*/];
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}); });
|
|
98
142
|
it('should show match rules as options correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
99
143
|
var user;
|
|
100
144
|
return __generator(this, function (_a) {
|
|
@@ -105,8 +149,27 @@ describe('MatchRulesSelector tests', function () {
|
|
|
105
149
|
case 1:
|
|
106
150
|
_a.sent();
|
|
107
151
|
expect(screen.getAllByRole('option')).toHaveLength(2);
|
|
108
|
-
screen.getByText('
|
|
109
|
-
screen.getByText('
|
|
152
|
+
screen.getByText('HCA Match Rule 1');
|
|
153
|
+
screen.getByText('HCA Match Rule 2');
|
|
154
|
+
return [2 /*return*/];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}); });
|
|
158
|
+
it('should show match rules as options correctly if entityTypeUris prop is empty array', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
159
|
+
var props, user;
|
|
160
|
+
return __generator(this, function (_a) {
|
|
161
|
+
switch (_a.label) {
|
|
162
|
+
case 0:
|
|
163
|
+
props = __assign(__assign({}, defaultProps), { entityTypeUris: [] });
|
|
164
|
+
user = setUp(props).user;
|
|
165
|
+
return [4 /*yield*/, user.click(screen.getByRole('combobox'))];
|
|
166
|
+
case 1:
|
|
167
|
+
_a.sent();
|
|
168
|
+
expect(screen.getAllByRole('option')).toHaveLength(4);
|
|
169
|
+
screen.getByText('HCA Match Rule 1');
|
|
170
|
+
screen.getByText('HCA Match Rule 2');
|
|
171
|
+
screen.getByText('HCP Match Rule 1');
|
|
172
|
+
screen.getByText('Individual Match Rule 1');
|
|
110
173
|
return [2 /*return*/];
|
|
111
174
|
}
|
|
112
175
|
});
|
|
@@ -122,8 +185,26 @@ describe('MatchRulesSelector tests', function () {
|
|
|
122
185
|
case 1:
|
|
123
186
|
_a.sent();
|
|
124
187
|
expect(screen.getAllByRole('option')).toHaveLength(2);
|
|
125
|
-
screen.getByText('
|
|
126
|
-
screen.getByText('
|
|
188
|
+
screen.getByText('HCA ML Match Rule 1');
|
|
189
|
+
screen.getByText('HCA ML Match Rule 2');
|
|
190
|
+
return [2 /*return*/];
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}); });
|
|
194
|
+
it('should show ml match rules as options correctly if entityTypeUris prop is empty array', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
195
|
+
var props, user;
|
|
196
|
+
return __generator(this, function (_a) {
|
|
197
|
+
switch (_a.label) {
|
|
198
|
+
case 0:
|
|
199
|
+
props = __assign(__assign({}, defaultProps), { name: MatchRulesAttrNames.MLRecommendedMatch, entityTypeUris: [] });
|
|
200
|
+
user = setUp(props).user;
|
|
201
|
+
return [4 /*yield*/, user.click(screen.getByRole('combobox'))];
|
|
202
|
+
case 1:
|
|
203
|
+
_a.sent();
|
|
204
|
+
expect(screen.getAllByRole('option')).toHaveLength(3);
|
|
205
|
+
screen.getByText('HCA ML Match Rule 1');
|
|
206
|
+
screen.getByText('HCA ML Match Rule 2');
|
|
207
|
+
screen.getByText('Individual ML Match Rule 1');
|
|
127
208
|
return [2 /*return*/];
|
|
128
209
|
}
|
|
129
210
|
});
|
|
@@ -133,7 +214,7 @@ describe('MatchRulesSelector tests', function () {
|
|
|
133
214
|
return __generator(this, function (_a) {
|
|
134
215
|
props = __assign(__assign({}, defaultProps), { values: ['configuration/entityTypes/HCA/matchGroups/HCABytsv'] });
|
|
135
216
|
setUp(props);
|
|
136
|
-
screen.getByText('
|
|
217
|
+
screen.getByText('HCA Match Rule 2');
|
|
137
218
|
return [2 /*return*/];
|
|
138
219
|
});
|
|
139
220
|
}); });
|
|
@@ -37,7 +37,7 @@ describe('SimpleAttribute tests', function () {
|
|
|
37
37
|
expect(dataTypeValue.prop('dataTypeDefinition')).toEqual({ type: 'String', uri: 'URI', name: 'Name' });
|
|
38
38
|
});
|
|
39
39
|
it('should provide correct props DataTypeValue if attribute is lookup', function () {
|
|
40
|
-
var attrType = { type: 'String', dependentLookupCode: 'Code', name: 'Name', uri: 'URI', access: [] };
|
|
40
|
+
var attrType = { type: 'String', dependentLookupCode: 'Code', name: 'Name', uri: 'URI', access: ['READ'] };
|
|
41
41
|
var attributeValue = {
|
|
42
42
|
value: '123',
|
|
43
43
|
lookupCode: '12',
|
|
@@ -48,7 +48,7 @@ describe('SimpleAttribute tests', function () {
|
|
|
48
48
|
var dataTypeValue = component.find(DataTypeValue);
|
|
49
49
|
expect(dataTypeValue.length).toBe(1);
|
|
50
50
|
expect(dataTypeValue.prop('value')).toEqual(pick(['value', 'lookupCode'], attributeValue));
|
|
51
|
-
expect(dataTypeValue.prop('dataTypeDefinition')).toEqual(__assign({ type: 'String', dependentLookupCode: 'Code', uri: 'URI', name: 'Name' }, { type: DataTypes.TYPE_DEPENDENT_LOOKUP }));
|
|
51
|
+
expect(dataTypeValue.prop('dataTypeDefinition')).toEqual(__assign({ access: ['READ'], type: 'String', dependentLookupCode: 'Code', uri: 'URI', name: 'Name' }, { type: DataTypes.TYPE_DEPENDENT_LOOKUP }));
|
|
52
52
|
});
|
|
53
53
|
it('should render CommentsContainer inside COMMENTS_CONTAINER_VISIBILITY_AREA with correct uri', function () {
|
|
54
54
|
var attrType = { type: 'String', name: 'Name', uri: 'uri1' };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AttributeTypeForMasking, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
2
2
|
type Props = {
|
|
3
3
|
attributeValue: SimpleAttributeValue;
|
|
4
|
-
attributeType:
|
|
4
|
+
attributeType: AttributeTypeForMasking;
|
|
5
5
|
};
|
|
6
6
|
export declare const useMaskedAttribute: ({ attributeType, attributeValue }: Props) => {
|
|
7
|
-
isUnmaskingNeeded:
|
|
7
|
+
isUnmaskingNeeded: any;
|
|
8
8
|
isMasked: boolean;
|
|
9
9
|
toggleMasking: () => void;
|
|
10
10
|
isUnmasking: boolean;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
2
|
import { useMdmIsViewMode } from '../../contexts/MdmModuleContext';
|
|
3
|
+
import { checkCanUnmaskAttribute } from '@reltio/mdm-sdk';
|
|
3
4
|
import { useMaskAttributeValue, useUnmaskAttributeValue, useUnmaskedAttributeValue } from '../../contexts/MaskedAttributesContext';
|
|
4
5
|
export var useMaskedAttribute = function (_a) {
|
|
5
6
|
var attributeType = _a.attributeType, attributeValue = _a.attributeValue;
|
|
6
7
|
var isViewMode = useMdmIsViewMode();
|
|
7
8
|
var unmaskAttributeValue = useUnmaskAttributeValue();
|
|
8
9
|
var maskAttributeValue = useMaskAttributeValue();
|
|
10
|
+
var canUnmaskAttribute = checkCanUnmaskAttribute(attributeType);
|
|
9
11
|
var _b = useUnmaskedAttributeValue(attributeValue.uri) || {}, unmaskedAttributeValue = _b.attributeValue, _c = _b.isUnmasked, isUnmasked = _c === void 0 ? false : _c, _d = _b.loading, loading = _d === void 0 ? false : _d;
|
|
10
|
-
var isUnmaskingNeeded = unmaskAttributeValue && maskAttributeValue && !!attributeType.masking && isViewMode;
|
|
12
|
+
var isUnmaskingNeeded = unmaskAttributeValue && maskAttributeValue && !!attributeType.masking && isViewMode && canUnmaskAttribute;
|
|
11
13
|
var unmask = useCallback(function () {
|
|
12
14
|
return isUnmaskingNeeded ? unmaskAttributeValue(attributeValue.uri) : Promise.resolve();
|
|
13
15
|
}, [unmaskAttributeValue, attributeValue.uri, isUnmaskingNeeded]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1987",
|
|
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
|
"@fluentui/react-context-selector": "^9.1.26",
|
|
9
9
|
"@react-google-maps/api": "2.7.0",
|
|
10
10
|
"@react-sigma/core": "3.4.0",
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1885",
|
|
12
12
|
"d3-cloud": "^1.2.5",
|
|
13
13
|
"d3-geo": "^2.0.1",
|
|
14
14
|
"d3-hierarchy": "^2.0.0",
|