@reltio/components 1.4.1781 → 1.4.1783
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/OvIcon/OvIcon.js +8 -8
- package/cjs/OvIcon/OvIcon.test.js +89 -15
- package/cjs/OvIcon/helpers.d.ts +2 -2
- package/cjs/OvIcon/helpers.js +26 -4
- package/cjs/components/MatchRulesBlock/SimpleMatchRules/styles.js +2 -1
- package/cjs/components/crosswalks/AttributesTable/cell-renderers/OvValuesRenderer.js +4 -1
- package/cjs/contexts/MdmModuleContext/hooks.d.ts +1 -0
- package/cjs/contexts/MdmModuleContext/hooks.js +7 -1
- package/cjs/contexts/MdmModuleContext/index.d.ts +1 -1
- package/cjs/contexts/MdmModuleContext/index.js +2 -1
- package/esm/OvIcon/OvIcon.js +7 -7
- package/esm/OvIcon/OvIcon.test.js +88 -14
- package/esm/OvIcon/helpers.d.ts +2 -2
- package/esm/OvIcon/helpers.js +25 -3
- package/esm/components/MatchRulesBlock/SimpleMatchRules/styles.js +2 -1
- package/esm/components/crosswalks/AttributesTable/cell-renderers/OvValuesRenderer.js +4 -1
- package/esm/contexts/MdmModuleContext/hooks.d.ts +1 -0
- package/esm/contexts/MdmModuleContext/hooks.js +6 -1
- package/esm/contexts/MdmModuleContext/index.d.ts +1 -1
- package/esm/contexts/MdmModuleContext/index.js +1 -1
- package/package.json +2 -2
package/cjs/OvIcon/OvIcon.js
CHANGED
|
@@ -33,27 +33,27 @@ var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
|
33
33
|
var Chip_1 = __importDefault(require("@mui/material/Chip"));
|
|
34
34
|
var DataTypeValue_1 = __importDefault(require("../components/DataTypeValue/DataTypeValue"));
|
|
35
35
|
var withTooltip_1 = require("../HOCs/withTooltip");
|
|
36
|
-
var
|
|
37
|
-
var EntityContext_1 = require("../contexts/EntityContext");
|
|
36
|
+
var contexts_1 = require("../contexts");
|
|
38
37
|
var helpers_1 = require("./helpers");
|
|
39
38
|
var styles_1 = require("./styles");
|
|
40
39
|
exports.ChipWithTooltip = (0, withTooltip_1.withTooltip)(Chip_1.default);
|
|
41
40
|
var OvIcon = function (_a) {
|
|
42
41
|
var className = _a.className, attributeType = _a.attributeType, _b = _a.nonOvValues, nonOvValues = _b === void 0 ? [] : _b, nonOvTotal = _a.nonOvTotal;
|
|
43
42
|
var styles = (0, styles_1.useStyles)();
|
|
44
|
-
var openEntity = (0,
|
|
45
|
-
var entity = (0, react_1.useContext)(
|
|
46
|
-
var
|
|
43
|
+
var openEntity = (0, contexts_1.useMdmAction)('openEntity');
|
|
44
|
+
var entity = (0, react_1.useContext)(contexts_1.EntityContext);
|
|
45
|
+
var linkedEntity = (0, helpers_1.getLinkedEntity)(entity, nonOvValues, attributeType);
|
|
46
|
+
var isSourcesScreenEnabled = (0, contexts_1.useMdmIsSourcesScreenEnabled)(linkedEntity === null || linkedEntity === void 0 ? void 0 : linkedEntity.type);
|
|
47
47
|
var onClick = (0, react_1.useCallback)(function () {
|
|
48
|
-
openEntity({ uri:
|
|
49
|
-
}, [openEntity,
|
|
48
|
+
openEntity({ uri: linkedEntity.uri, screen: 'sources' });
|
|
49
|
+
}, [openEntity, linkedEntity]);
|
|
50
50
|
if (!nonOvTotal) {
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
53
|
var tooltipTitle = nonOvValues.length
|
|
54
54
|
? nonOvValues.map(function (value, i) { return (react_1.default.createElement("div", { key: i }, (0, mdm_sdk_1.isComplexAttribute)(attributeType) ? ((0, mdm_sdk_1.getLabel)(value.label)) : (react_1.default.createElement(DataTypeValue_1.default, { value: (0, mdm_sdk_1.getAttributeValue)(value), dataTypeDefinition: (0, mdm_sdk_1.getAttrDataTypeDefinition)(attributeType), rich: false })))); })
|
|
55
55
|
: null;
|
|
56
|
-
return (react_1.default.createElement(exports.ChipWithTooltip, { tooltipTitle: tooltipTitle, tooltipPlacement: "bottom", label: "+ ".concat(nonOvTotal), variant: "outlined", onClick:
|
|
56
|
+
return (react_1.default.createElement(exports.ChipWithTooltip, { tooltipTitle: tooltipTitle, tooltipPlacement: "bottom", label: "+ ".concat(nonOvTotal), variant: "outlined", onClick: (linkedEntity === null || linkedEntity === void 0 ? void 0 : linkedEntity.uri) && isSourcesScreenEnabled ? onClick : undefined, classes: {
|
|
57
57
|
root: (0, classnames_1.default)(styles.container, className),
|
|
58
58
|
label: styles.label
|
|
59
59
|
} }));
|
|
@@ -53,17 +53,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
53
53
|
var react_1 = __importDefault(require("react"));
|
|
54
54
|
var react_2 = require("@testing-library/react");
|
|
55
55
|
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
56
|
-
var
|
|
57
|
-
var EntityContext_1 = require("../contexts/EntityContext");
|
|
56
|
+
var contexts_1 = require("../contexts");
|
|
58
57
|
var OvIcon_1 = require("./OvIcon");
|
|
59
58
|
var openEntity = jest.fn();
|
|
60
|
-
var
|
|
61
|
-
|
|
59
|
+
var defaultMdmValues = {
|
|
60
|
+
uiConfigProfile: []
|
|
61
|
+
};
|
|
62
|
+
var setUp = function (_a) {
|
|
63
|
+
var props = _a.props, _b = _a.entityContextValue, entityContextValue = _b === void 0 ? null : _b, _c = _a.mdmValues, mdmValues = _c === void 0 ? defaultMdmValues : _c;
|
|
62
64
|
var user = user_event_1.default.setup();
|
|
63
65
|
var Providers = function (_a) {
|
|
64
66
|
var children = _a.children;
|
|
65
|
-
return (react_1.default.createElement(
|
|
66
|
-
react_1.default.createElement(
|
|
67
|
+
return (react_1.default.createElement(contexts_1.EntityContext.Provider, { value: entityContextValue },
|
|
68
|
+
react_1.default.createElement(contexts_1.MdmModuleProvider, { actions: { openEntity: openEntity }, values: mdmValues }, children)));
|
|
67
69
|
};
|
|
68
70
|
return __assign(__assign({}, (0, react_2.render)(react_1.default.createElement(OvIcon_1.OvIcon, __assign({}, props)), { wrapper: Providers })), { user: user });
|
|
69
71
|
};
|
|
@@ -74,7 +76,7 @@ describe('Ov Icon tests', function () {
|
|
|
74
76
|
it('should render nothing if nonOvTotal = 0', function () {
|
|
75
77
|
var attributeType = { type: 'String', name: 'String', uri: 'configuration/entityTypes/HCO/attributes/String' };
|
|
76
78
|
var props = { attributeType: attributeType, nonOvValues: [], nonOvTotal: 0 };
|
|
77
|
-
var container = setUp(props).container;
|
|
79
|
+
var container = setUp({ props: props }).container;
|
|
78
80
|
expect(container).toBeEmptyDOMElement();
|
|
79
81
|
});
|
|
80
82
|
it('should not render tooltip if nonOvValues.length == 0', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -85,7 +87,7 @@ describe('Ov Icon tests', function () {
|
|
|
85
87
|
attributeType = { type: 'String', name: 'String', uri: 'configuration/entityTypes/HCO/attributes/String' };
|
|
86
88
|
nonOvValues = [];
|
|
87
89
|
props = { attributeType: attributeType, nonOvValues: nonOvValues, nonOvTotal: 1 };
|
|
88
|
-
user = setUp(props).user;
|
|
90
|
+
user = setUp({ props: props }).user;
|
|
89
91
|
return [4 /*yield*/, user.hover(react_2.screen.getByText('+ 1'))];
|
|
90
92
|
case 1:
|
|
91
93
|
_a.sent();
|
|
@@ -105,7 +107,7 @@ describe('Ov Icon tests', function () {
|
|
|
105
107
|
{ value: 43, uri: '345' }
|
|
106
108
|
];
|
|
107
109
|
props = { attributeType: attributeType, nonOvValues: nonOvValues, nonOvTotal: nonOvValues.length };
|
|
108
|
-
user = setUp(props).user;
|
|
110
|
+
user = setUp({ props: props }).user;
|
|
109
111
|
return [4 /*yield*/, user.hover(react_2.screen.getByText('+ 2'))];
|
|
110
112
|
case 1:
|
|
111
113
|
_a.sent();
|
|
@@ -124,7 +126,7 @@ describe('Ov Icon tests', function () {
|
|
|
124
126
|
attributeType = { type: 'Nested', name: 'Nested', uri: 'configuration/entityTypes/HCO/attributes/Nested' };
|
|
125
127
|
nonOvValues = [{ value: { a: [] }, label: 'Nested label', uri: '123' }];
|
|
126
128
|
props = { attributeType: attributeType, nonOvValues: nonOvValues, nonOvTotal: nonOvValues.length };
|
|
127
|
-
user = setUp(props).user;
|
|
129
|
+
user = setUp({ props: props }).user;
|
|
128
130
|
return [4 /*yield*/, user.hover(react_2.screen.getByText('+ 1'))];
|
|
129
131
|
case 1:
|
|
130
132
|
_a.sent();
|
|
@@ -145,7 +147,7 @@ describe('Ov Icon tests', function () {
|
|
|
145
147
|
{ value: 43, uri: 'relations/123/attributes/345' }
|
|
146
148
|
];
|
|
147
149
|
props = { attributeType: attributeType, nonOvValues: nonOvValues, nonOvTotal: nonOvValues.length };
|
|
148
|
-
user = setUp(props).user;
|
|
150
|
+
user = setUp({ props: props }).user;
|
|
149
151
|
return [4 /*yield*/, user.click(react_2.screen.getByText('+ 2'))];
|
|
150
152
|
case 1:
|
|
151
153
|
_a.sent();
|
|
@@ -155,7 +157,7 @@ describe('Ov Icon tests', function () {
|
|
|
155
157
|
});
|
|
156
158
|
}); });
|
|
157
159
|
it('should call openEntity on click with correct entity uri if nonOvValues has items with relation uri and context has entity', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
158
|
-
var entity, attributeType, nonOvValues, props, user;
|
|
160
|
+
var entity, attributeType, nonOvValues, props, mdmValues, user;
|
|
159
161
|
return __generator(this, function (_a) {
|
|
160
162
|
switch (_a.label) {
|
|
161
163
|
case 0:
|
|
@@ -166,7 +168,16 @@ describe('Ov Icon tests', function () {
|
|
|
166
168
|
{ value: 43, uri: 'relations/123/attributes/345' }
|
|
167
169
|
];
|
|
168
170
|
props = { attributeType: attributeType, nonOvValues: nonOvValues, nonOvTotal: nonOvValues.length };
|
|
169
|
-
|
|
171
|
+
mdmValues = {
|
|
172
|
+
uiConfigProfile: [
|
|
173
|
+
{
|
|
174
|
+
class: 'Sources',
|
|
175
|
+
label: 'Sources',
|
|
176
|
+
visible: ['configuration/entityTypes/HCP']
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
};
|
|
180
|
+
user = setUp({ props: props, entityContextValue: entity, mdmValues: mdmValues }).user;
|
|
170
181
|
return [4 /*yield*/, user.click(react_2.screen.getByText('+ 2'))];
|
|
171
182
|
case 1:
|
|
172
183
|
_a.sent();
|
|
@@ -176,7 +187,7 @@ describe('Ov Icon tests', function () {
|
|
|
176
187
|
});
|
|
177
188
|
}); });
|
|
178
189
|
it('should call openEntity on click with correct entity uri if nonOvValues has items with entity uri', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
179
|
-
var attributeType, nonOvValues, props, user;
|
|
190
|
+
var attributeType, nonOvValues, props, mdmValues, user;
|
|
180
191
|
return __generator(this, function (_a) {
|
|
181
192
|
switch (_a.label) {
|
|
182
193
|
case 0:
|
|
@@ -186,7 +197,16 @@ describe('Ov Icon tests', function () {
|
|
|
186
197
|
{ value: 43, uri: 'entities/123/attributes/345' }
|
|
187
198
|
];
|
|
188
199
|
props = { attributeType: attributeType, nonOvValues: nonOvValues, nonOvTotal: nonOvValues.length };
|
|
189
|
-
|
|
200
|
+
mdmValues = {
|
|
201
|
+
uiConfigProfile: [
|
|
202
|
+
{
|
|
203
|
+
class: 'Sources',
|
|
204
|
+
label: 'Sources',
|
|
205
|
+
visible: ['configuration/entityTypes/HCO']
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
};
|
|
209
|
+
user = setUp({ props: props, mdmValues: mdmValues }).user;
|
|
190
210
|
return [4 /*yield*/, user.click(react_2.screen.getByText('+ 2'))];
|
|
191
211
|
case 1:
|
|
192
212
|
_a.sent();
|
|
@@ -195,4 +215,58 @@ describe('Ov Icon tests', function () {
|
|
|
195
215
|
}
|
|
196
216
|
});
|
|
197
217
|
}); });
|
|
218
|
+
it('should call openEntity on click with correct entity uri if attribute is a sub attribute of reference attribute', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
219
|
+
var entity, attributeType, nonOvValues, props, mdmValues, user;
|
|
220
|
+
return __generator(this, function (_a) {
|
|
221
|
+
switch (_a.label) {
|
|
222
|
+
case 0:
|
|
223
|
+
entity = {
|
|
224
|
+
uri: 'entities/246',
|
|
225
|
+
type: 'configuration/entityTypes/HCP',
|
|
226
|
+
attributes: {
|
|
227
|
+
Affiliations: [
|
|
228
|
+
{
|
|
229
|
+
label: 'Francis Luna',
|
|
230
|
+
uri: 'entities/246/attributes/Affiliations/04cbsvm',
|
|
231
|
+
refEntity: {
|
|
232
|
+
objectURI: 'entities/123',
|
|
233
|
+
type: 'configuration/entityTypes/HCA'
|
|
234
|
+
},
|
|
235
|
+
refRelation: {},
|
|
236
|
+
value: {}
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
attributeType = {
|
|
242
|
+
type: 'String',
|
|
243
|
+
name: 'String',
|
|
244
|
+
uri: 'configuration/entityTypes/HCA/attributes/CountryCode'
|
|
245
|
+
};
|
|
246
|
+
nonOvValues = [
|
|
247
|
+
{
|
|
248
|
+
value: 42,
|
|
249
|
+
uri: 'entities/246/attributes/Affiliations/04cbsvm/CountryCode/3TyGUD0Mq',
|
|
250
|
+
type: 'configuration/entityTypes/HCA/attributes/CountryCode'
|
|
251
|
+
}
|
|
252
|
+
];
|
|
253
|
+
props = { attributeType: attributeType, nonOvValues: nonOvValues, nonOvTotal: nonOvValues.length };
|
|
254
|
+
mdmValues = {
|
|
255
|
+
uiConfigProfile: [
|
|
256
|
+
{
|
|
257
|
+
class: 'Sources',
|
|
258
|
+
label: 'Sources',
|
|
259
|
+
visible: ['configuration/entityTypes/HCA']
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
};
|
|
263
|
+
user = setUp({ props: props, entityContextValue: entity, mdmValues: mdmValues }).user;
|
|
264
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('+ 1'))];
|
|
265
|
+
case 1:
|
|
266
|
+
_a.sent();
|
|
267
|
+
expect(openEntity).toHaveBeenCalledWith({ uri: 'entities/123', screen: 'sources' });
|
|
268
|
+
return [2 /*return*/];
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}); });
|
|
198
272
|
});
|
package/cjs/OvIcon/helpers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Entity, NestedAttributeValue, ReferenceAttributeValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
1
|
+
import { Entity, NestedAttributeValue, ReferenceAttributeValue, SimpleAttributeValue, AttributeType } from '@reltio/mdm-sdk';
|
|
2
2
|
type NonOvValues = Array<SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue>;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const getLinkedEntity: (entity: Entity, nonOvValues: NonOvValues, attributeType: AttributeType) => Entity;
|
|
4
4
|
export {};
|
package/cjs/OvIcon/helpers.js
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getLinkedEntity = void 0;
|
|
4
4
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
5
|
-
var
|
|
5
|
+
var getLinkedEntity = function (entity, nonOvValues, attributeType) {
|
|
6
6
|
var _a;
|
|
7
7
|
var attributeUri = (_a = nonOvValues === null || nonOvValues === void 0 ? void 0 : nonOvValues[0]) === null || _a === void 0 ? void 0 : _a.uri;
|
|
8
8
|
var entityOrRelationUri = attributeUri ? (0, mdm_sdk_1.getEntityUriFromAttributeUri)(attributeUri) : null;
|
|
9
|
-
|
|
9
|
+
if (entityOrRelationUri && (0, mdm_sdk_1.isEntityUri)(entityOrRelationUri)) {
|
|
10
|
+
var entityType = (0, mdm_sdk_1.getEntityUriFromAttributeUri)(attributeType.uri);
|
|
11
|
+
if (!entity || entity.type === entityType) {
|
|
12
|
+
return {
|
|
13
|
+
uri: entityOrRelationUri,
|
|
14
|
+
type: entityType
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
var parentAttributeUri = (0, mdm_sdk_1.getParentUri)(attributeUri);
|
|
18
|
+
var parentAttribute = (0, mdm_sdk_1.findAttributeValueByUri)(entity, parentAttributeUri);
|
|
19
|
+
return {
|
|
20
|
+
uri: (0, mdm_sdk_1.getReferencedEntityUriFromAttrValue)(parentAttribute),
|
|
21
|
+
type: entityType
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return entity
|
|
26
|
+
? {
|
|
27
|
+
uri: entity.uri,
|
|
28
|
+
type: entity.type
|
|
29
|
+
}
|
|
30
|
+
: null;
|
|
31
|
+
}
|
|
10
32
|
};
|
|
11
|
-
exports.
|
|
33
|
+
exports.getLinkedEntity = getLinkedEntity;
|
|
@@ -7,14 +7,17 @@ var react_1 = __importDefault(require("react"));
|
|
|
7
7
|
var DragIndicator_1 = __importDefault(require("@mui/icons-material/DragIndicator"));
|
|
8
8
|
var ReadOnlyAttributeValuesBlock_1 = require("../../../../ReadOnlyAttributeValuesBlock");
|
|
9
9
|
var Title_1 = __importDefault(require("../../../Title/Title"));
|
|
10
|
+
var contexts_1 = require("../../../../contexts");
|
|
10
11
|
var styles_1 = require("./styles");
|
|
11
12
|
var OvValuesRenderer = function (_a) {
|
|
12
13
|
var _b = _a.value, values = _b.values, attributeType = _b.attributeType, someRowIsDragging = _a.someRowIsDragging, dragRef = _a.dragRef;
|
|
13
14
|
var styles = (0, styles_1.useStyles)();
|
|
15
|
+
var entity = (0, contexts_1.useMdmEntity)();
|
|
14
16
|
return (react_1.default.createElement("div", { className: styles.cellValueWrapper },
|
|
15
17
|
react_1.default.createElement("div", { ref: dragRef, className: styles.dragIndicator },
|
|
16
18
|
react_1.default.createElement(DragIndicator_1.default, { className: styles.dragIndicatorIcon })),
|
|
17
19
|
react_1.default.createElement(Title_1.default, { className: styles.attributeTitle, label: attributeType.label }),
|
|
18
|
-
!someRowIsDragging && (react_1.default.createElement(
|
|
20
|
+
!someRowIsDragging && (react_1.default.createElement(contexts_1.EntityContext.Provider, { value: entity },
|
|
21
|
+
react_1.default.createElement(ReadOnlyAttributeValuesBlock_1.ReadOnlyAttributeValuesBlock, { values: values, attributeType: attributeType, valueContainerClassName: styles.ovValue })))));
|
|
19
22
|
};
|
|
20
23
|
exports.default = OvValuesRenderer;
|
|
@@ -50,6 +50,7 @@ export declare const useMdmSearchProviderData: () => import("@reltio/mdm-sdk").S
|
|
|
50
50
|
export declare const useMdmIsCollaborationEnabled: () => boolean;
|
|
51
51
|
export declare const useMdmIsWorkflowEnabled: () => boolean;
|
|
52
52
|
export declare const useMdmProfileErrors: () => import("@reltio/mdm-sdk").AttributeError[];
|
|
53
|
+
export declare const useMdmIsSourcesScreenEnabled: (entityTypeUri: string) => boolean;
|
|
53
54
|
export declare const useMdmModifiedEntityDefaultProfilePic: (entityUri: string) => string;
|
|
54
55
|
export declare const useMdmModifiedEntity: (entityUri: string) => import("@reltio/mdm-sdk").Entity;
|
|
55
56
|
export declare const useMdmInitialConnectionTempEntity: (viewId: string, relationUri: string) => any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMdmIsWorkflowEnabled = exports.useMdmIsCollaborationEnabled = exports.useMdmSearchProviderData = exports.useMdmSearchNavigationData = exports.useMdmDataTenants = exports.useMdmEnvironment = exports.useMdmTenantName = exports.useMdmTenant = exports.useMdmTenantObject = exports.useMdmUserRoles = exports.useMdmUsername = exports.useMdmUser = exports.useMdmMetadata = exports.useMdmDependentLookups = exports.useMdmLookups = exports.useMdmProfileLastLoadedTime = exports.useMdmHistoryEvent = exports.useMdmHistorySlice = exports.useMdmHistoryMode = exports.useMdmHistoryDiff = exports.useMdmIsEditableMode = exports.useMdmIsViewMode = exports.useMdmMode = exports.useMdmEntityUriWithDataTenant = exports.useMdmEntityWithDiff = exports.useMdmEntityUri = exports.useMdmEntity = exports.useMdmModifiedEntities = exports.useMdmLookupAutocomplete = exports.useMdmAttributesSortingStrategy = exports.useMdmMaxValuesInResponse = exports.useMdmAttributesPresentation = exports.useMdmDateTimeMask = exports.useMdmDateMask = exports.useMdmPivotingAttributes = exports.useMdmShowEntityId = exports.useMdmImageAttributesFieldsOrder = exports.useMdmCollaborationPath = exports.useMdmApiPath = exports.useMdmReltioPath = exports.useMdmImageServicePath = exports.useMdmWorkflowPath = exports.useMdmServicesPath = exports.useMdmDtssPath = exports.useMdmUiPath = exports.useMdmAbsoluteImagePath = exports.useMdmExportPath = exports.useMdmWorkflowEnvironmentUrl = exports.useMdmUiError = exports.useMdmAutoCloseInterval = void 0;
|
|
4
|
-
exports.useMdmListener = exports.useMdmAction = exports.useMdmAuthoringItemsByEntityType = exports.useMdmGlobalSearchRequestOptions = exports.useMdmDependentLookupEditorContext = exports.useMdmRelationsDrafts = exports.useMdmAllRelationsToAddAndEdit = exports.useMdmDependentLookupsStructureNode = exports.useMdmActiveErrorsForAttributesPager = exports.useMdmDependentLookupEditorState = exports.useMdmInitialConnection = exports.useMdmInitialConnectionTempEntity = exports.useMdmModifiedEntity = exports.useMdmModifiedEntityDefaultProfilePic = exports.useMdmProfileErrors = void 0;
|
|
4
|
+
exports.useMdmListener = exports.useMdmAction = exports.useMdmAuthoringItemsByEntityType = exports.useMdmGlobalSearchRequestOptions = exports.useMdmDependentLookupEditorContext = exports.useMdmRelationsDrafts = exports.useMdmAllRelationsToAddAndEdit = exports.useMdmDependentLookupsStructureNode = exports.useMdmActiveErrorsForAttributesPager = exports.useMdmDependentLookupEditorState = exports.useMdmInitialConnection = exports.useMdmInitialConnectionTempEntity = exports.useMdmModifiedEntity = exports.useMdmModifiedEntityDefaultProfilePic = exports.useMdmIsSourcesScreenEnabled = exports.useMdmProfileErrors = void 0;
|
|
5
5
|
var react_context_selector_1 = require("@fluentui/react-context-selector");
|
|
6
6
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
7
7
|
var context_1 = require("./context");
|
|
@@ -130,6 +130,12 @@ var useMdmIsWorkflowEnabled = function () { return useMdmModuleValuesContext(fun
|
|
|
130
130
|
exports.useMdmIsWorkflowEnabled = useMdmIsWorkflowEnabled;
|
|
131
131
|
var useMdmProfileErrors = function () { return useMdmModuleValuesContext(function (context) { return context.profileErrors; }); };
|
|
132
132
|
exports.useMdmProfileErrors = useMdmProfileErrors;
|
|
133
|
+
var useMdmIsSourcesScreenEnabled = function (entityTypeUri) {
|
|
134
|
+
return useMdmModuleValuesContext(function (context) {
|
|
135
|
+
return (0, mdm_sdk_1.checkProfileScreenIsEnabled)(context.uiConfigProfile, mdm_sdk_1.ScreenType.Sources, entityTypeUri);
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
exports.useMdmIsSourcesScreenEnabled = useMdmIsSourcesScreenEnabled;
|
|
133
139
|
var useMdmModifiedEntityDefaultProfilePic = function (entityUri) {
|
|
134
140
|
return useMdmModuleValuesContext(function (context) {
|
|
135
141
|
return (0, entity_1.getModifiedEntityDefaultProfilePic)(context.modifiedEntities, entityUri);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { MdmModuleProvider } from './provider';
|
|
2
|
-
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener } from './hooks';
|
|
2
|
+
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled } from './hooks';
|
|
3
3
|
export type { MdmModuleActionsContextProps, MdmModuleValuesContextProps, MdmModuleListenersContextProps } from './context';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMdmIsCollaborationEnabled = exports.useMdmSearchProviderData = exports.useMdmSearchNavigationData = exports.useMdmDataTenants = exports.useMdmEnvironment = exports.useMdmTenantName = exports.useMdmTenant = exports.useMdmTenantObject = exports.useMdmUserRoles = exports.useMdmUsername = exports.useMdmUser = exports.useMdmMetadata = exports.useMdmDependentLookups = exports.useMdmLookups = exports.useMdmProfileLastLoadedTime = exports.useMdmHistoryEvent = exports.useMdmHistorySlice = exports.useMdmHistoryMode = exports.useMdmHistoryDiff = exports.useMdmIsEditableMode = exports.useMdmIsViewMode = exports.useMdmMode = exports.useMdmEntityUriWithDataTenant = exports.useMdmEntityWithDiff = exports.useMdmEntityUri = exports.useMdmEntity = exports.useMdmModifiedEntities = exports.useMdmLookupAutocomplete = exports.useMdmAttributesSortingStrategy = exports.useMdmMaxValuesInResponse = exports.useMdmAttributesPresentation = exports.useMdmDateTimeMask = exports.useMdmDateMask = exports.useMdmPivotingAttributes = exports.useMdmShowEntityId = exports.useMdmImageAttributesFieldsOrder = exports.useMdmCollaborationPath = exports.useMdmApiPath = exports.useMdmReltioPath = exports.useMdmImageServicePath = exports.useMdmWorkflowPath = exports.useMdmServicesPath = exports.useMdmDtssPath = exports.useMdmUiPath = exports.useMdmAbsoluteImagePath = exports.useMdmExportPath = exports.useMdmWorkflowEnvironmentUrl = exports.useMdmUiError = exports.useMdmAutoCloseInterval = exports.MdmModuleProvider = void 0;
|
|
4
|
-
exports.useMdmListener = exports.useMdmAction = exports.useMdmAuthoringItemsByEntityType = exports.useMdmGlobalSearchRequestOptions = exports.useMdmDependentLookupEditorContext = exports.useMdmAllRelationsToAddAndEdit = exports.useMdmDependentLookupsStructureNode = exports.useMdmActiveErrorsForAttributesPager = exports.useMdmDependentLookupEditorState = exports.useMdmInitialConnection = exports.useMdmInitialConnectionTempEntity = exports.useMdmModifiedEntity = exports.useMdmModifiedEntityDefaultProfilePic = exports.useMdmRelationsDrafts = exports.useMdmProfileErrors = exports.useMdmIsWorkflowEnabled = void 0;
|
|
4
|
+
exports.useMdmIsSourcesScreenEnabled = exports.useMdmListener = exports.useMdmAction = exports.useMdmAuthoringItemsByEntityType = exports.useMdmGlobalSearchRequestOptions = exports.useMdmDependentLookupEditorContext = exports.useMdmAllRelationsToAddAndEdit = exports.useMdmDependentLookupsStructureNode = exports.useMdmActiveErrorsForAttributesPager = exports.useMdmDependentLookupEditorState = exports.useMdmInitialConnection = exports.useMdmInitialConnectionTempEntity = exports.useMdmModifiedEntity = exports.useMdmModifiedEntityDefaultProfilePic = exports.useMdmRelationsDrafts = exports.useMdmProfileErrors = exports.useMdmIsWorkflowEnabled = void 0;
|
|
5
5
|
var provider_1 = require("./provider");
|
|
6
6
|
Object.defineProperty(exports, "MdmModuleProvider", { enumerable: true, get: function () { return provider_1.MdmModuleProvider; } });
|
|
7
7
|
var hooks_1 = require("./hooks");
|
|
@@ -70,3 +70,4 @@ Object.defineProperty(exports, "useMdmGlobalSearchRequestOptions", { enumerable:
|
|
|
70
70
|
Object.defineProperty(exports, "useMdmAuthoringItemsByEntityType", { enumerable: true, get: function () { return hooks_1.useMdmAuthoringItemsByEntityType; } });
|
|
71
71
|
Object.defineProperty(exports, "useMdmAction", { enumerable: true, get: function () { return hooks_1.useMdmAction; } });
|
|
72
72
|
Object.defineProperty(exports, "useMdmListener", { enumerable: true, get: function () { return hooks_1.useMdmListener; } });
|
|
73
|
+
Object.defineProperty(exports, "useMdmIsSourcesScreenEnabled", { enumerable: true, get: function () { return hooks_1.useMdmIsSourcesScreenEnabled; } });
|
package/esm/OvIcon/OvIcon.js
CHANGED
|
@@ -4,9 +4,8 @@ import { getAttrDataTypeDefinition, getAttributeValue, isComplexAttribute, getLa
|
|
|
4
4
|
import Chip from '@mui/material/Chip';
|
|
5
5
|
import DataTypeValue from '../components/DataTypeValue/DataTypeValue';
|
|
6
6
|
import { withTooltip } from '../HOCs/withTooltip';
|
|
7
|
-
import { useMdmAction } from '../contexts
|
|
8
|
-
import {
|
|
9
|
-
import { getEntityUri } from './helpers';
|
|
7
|
+
import { EntityContext, useMdmAction, useMdmIsSourcesScreenEnabled } from '../contexts';
|
|
8
|
+
import { getLinkedEntity } from './helpers';
|
|
10
9
|
import { useStyles } from './styles';
|
|
11
10
|
export var ChipWithTooltip = withTooltip(Chip);
|
|
12
11
|
export var OvIcon = function (_a) {
|
|
@@ -14,17 +13,18 @@ export var OvIcon = function (_a) {
|
|
|
14
13
|
var styles = useStyles();
|
|
15
14
|
var openEntity = useMdmAction('openEntity');
|
|
16
15
|
var entity = useContext(EntityContext);
|
|
17
|
-
var
|
|
16
|
+
var linkedEntity = getLinkedEntity(entity, nonOvValues, attributeType);
|
|
17
|
+
var isSourcesScreenEnabled = useMdmIsSourcesScreenEnabled(linkedEntity === null || linkedEntity === void 0 ? void 0 : linkedEntity.type);
|
|
18
18
|
var onClick = useCallback(function () {
|
|
19
|
-
openEntity({ uri:
|
|
20
|
-
}, [openEntity,
|
|
19
|
+
openEntity({ uri: linkedEntity.uri, screen: 'sources' });
|
|
20
|
+
}, [openEntity, linkedEntity]);
|
|
21
21
|
if (!nonOvTotal) {
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
24
|
var tooltipTitle = nonOvValues.length
|
|
25
25
|
? nonOvValues.map(function (value, i) { return (React.createElement("div", { key: i }, isComplexAttribute(attributeType) ? (getLabel(value.label)) : (React.createElement(DataTypeValue, { value: getAttributeValue(value), dataTypeDefinition: getAttrDataTypeDefinition(attributeType), rich: false })))); })
|
|
26
26
|
: null;
|
|
27
|
-
return (React.createElement(ChipWithTooltip, { tooltipTitle: tooltipTitle, tooltipPlacement: "bottom", label: "+ ".concat(nonOvTotal), variant: "outlined", onClick:
|
|
27
|
+
return (React.createElement(ChipWithTooltip, { tooltipTitle: tooltipTitle, tooltipPlacement: "bottom", label: "+ ".concat(nonOvTotal), variant: "outlined", onClick: (linkedEntity === null || linkedEntity === void 0 ? void 0 : linkedEntity.uri) && isSourcesScreenEnabled ? onClick : undefined, classes: {
|
|
28
28
|
root: classnames(styles.container, className),
|
|
29
29
|
label: styles.label
|
|
30
30
|
} }));
|
|
@@ -48,17 +48,19 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
import React from 'react';
|
|
49
49
|
import { render, screen, within } from '@testing-library/react';
|
|
50
50
|
import userEvent from '@testing-library/user-event';
|
|
51
|
-
import { MdmModuleProvider } from '../contexts
|
|
52
|
-
import { EntityContext } from '../contexts/EntityContext';
|
|
51
|
+
import { EntityContext, MdmModuleProvider } from '../contexts';
|
|
53
52
|
import { OvIcon } from './OvIcon';
|
|
54
53
|
var openEntity = jest.fn();
|
|
55
|
-
var
|
|
56
|
-
|
|
54
|
+
var defaultMdmValues = {
|
|
55
|
+
uiConfigProfile: []
|
|
56
|
+
};
|
|
57
|
+
var setUp = function (_a) {
|
|
58
|
+
var props = _a.props, _b = _a.entityContextValue, entityContextValue = _b === void 0 ? null : _b, _c = _a.mdmValues, mdmValues = _c === void 0 ? defaultMdmValues : _c;
|
|
57
59
|
var user = userEvent.setup();
|
|
58
60
|
var Providers = function (_a) {
|
|
59
61
|
var children = _a.children;
|
|
60
62
|
return (React.createElement(EntityContext.Provider, { value: entityContextValue },
|
|
61
|
-
React.createElement(MdmModuleProvider, { actions: { openEntity: openEntity } }, children)));
|
|
63
|
+
React.createElement(MdmModuleProvider, { actions: { openEntity: openEntity }, values: mdmValues }, children)));
|
|
62
64
|
};
|
|
63
65
|
return __assign(__assign({}, render(React.createElement(OvIcon, __assign({}, props)), { wrapper: Providers })), { user: user });
|
|
64
66
|
};
|
|
@@ -69,7 +71,7 @@ describe('Ov Icon tests', function () {
|
|
|
69
71
|
it('should render nothing if nonOvTotal = 0', function () {
|
|
70
72
|
var attributeType = { type: 'String', name: 'String', uri: 'configuration/entityTypes/HCO/attributes/String' };
|
|
71
73
|
var props = { attributeType: attributeType, nonOvValues: [], nonOvTotal: 0 };
|
|
72
|
-
var container = setUp(props).container;
|
|
74
|
+
var container = setUp({ props: props }).container;
|
|
73
75
|
expect(container).toBeEmptyDOMElement();
|
|
74
76
|
});
|
|
75
77
|
it('should not render tooltip if nonOvValues.length == 0', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -80,7 +82,7 @@ describe('Ov Icon tests', function () {
|
|
|
80
82
|
attributeType = { type: 'String', name: 'String', uri: 'configuration/entityTypes/HCO/attributes/String' };
|
|
81
83
|
nonOvValues = [];
|
|
82
84
|
props = { attributeType: attributeType, nonOvValues: nonOvValues, nonOvTotal: 1 };
|
|
83
|
-
user = setUp(props).user;
|
|
85
|
+
user = setUp({ props: props }).user;
|
|
84
86
|
return [4 /*yield*/, user.hover(screen.getByText('+ 1'))];
|
|
85
87
|
case 1:
|
|
86
88
|
_a.sent();
|
|
@@ -100,7 +102,7 @@ describe('Ov Icon tests', function () {
|
|
|
100
102
|
{ value: 43, uri: '345' }
|
|
101
103
|
];
|
|
102
104
|
props = { attributeType: attributeType, nonOvValues: nonOvValues, nonOvTotal: nonOvValues.length };
|
|
103
|
-
user = setUp(props).user;
|
|
105
|
+
user = setUp({ props: props }).user;
|
|
104
106
|
return [4 /*yield*/, user.hover(screen.getByText('+ 2'))];
|
|
105
107
|
case 1:
|
|
106
108
|
_a.sent();
|
|
@@ -119,7 +121,7 @@ describe('Ov Icon tests', function () {
|
|
|
119
121
|
attributeType = { type: 'Nested', name: 'Nested', uri: 'configuration/entityTypes/HCO/attributes/Nested' };
|
|
120
122
|
nonOvValues = [{ value: { a: [] }, label: 'Nested label', uri: '123' }];
|
|
121
123
|
props = { attributeType: attributeType, nonOvValues: nonOvValues, nonOvTotal: nonOvValues.length };
|
|
122
|
-
user = setUp(props).user;
|
|
124
|
+
user = setUp({ props: props }).user;
|
|
123
125
|
return [4 /*yield*/, user.hover(screen.getByText('+ 1'))];
|
|
124
126
|
case 1:
|
|
125
127
|
_a.sent();
|
|
@@ -140,7 +142,7 @@ describe('Ov Icon tests', function () {
|
|
|
140
142
|
{ value: 43, uri: 'relations/123/attributes/345' }
|
|
141
143
|
];
|
|
142
144
|
props = { attributeType: attributeType, nonOvValues: nonOvValues, nonOvTotal: nonOvValues.length };
|
|
143
|
-
user = setUp(props).user;
|
|
145
|
+
user = setUp({ props: props }).user;
|
|
144
146
|
return [4 /*yield*/, user.click(screen.getByText('+ 2'))];
|
|
145
147
|
case 1:
|
|
146
148
|
_a.sent();
|
|
@@ -150,7 +152,7 @@ describe('Ov Icon tests', function () {
|
|
|
150
152
|
});
|
|
151
153
|
}); });
|
|
152
154
|
it('should call openEntity on click with correct entity uri if nonOvValues has items with relation uri and context has entity', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
153
|
-
var entity, attributeType, nonOvValues, props, user;
|
|
155
|
+
var entity, attributeType, nonOvValues, props, mdmValues, user;
|
|
154
156
|
return __generator(this, function (_a) {
|
|
155
157
|
switch (_a.label) {
|
|
156
158
|
case 0:
|
|
@@ -161,7 +163,16 @@ describe('Ov Icon tests', function () {
|
|
|
161
163
|
{ value: 43, uri: 'relations/123/attributes/345' }
|
|
162
164
|
];
|
|
163
165
|
props = { attributeType: attributeType, nonOvValues: nonOvValues, nonOvTotal: nonOvValues.length };
|
|
164
|
-
|
|
166
|
+
mdmValues = {
|
|
167
|
+
uiConfigProfile: [
|
|
168
|
+
{
|
|
169
|
+
class: 'Sources',
|
|
170
|
+
label: 'Sources',
|
|
171
|
+
visible: ['configuration/entityTypes/HCP']
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
};
|
|
175
|
+
user = setUp({ props: props, entityContextValue: entity, mdmValues: mdmValues }).user;
|
|
165
176
|
return [4 /*yield*/, user.click(screen.getByText('+ 2'))];
|
|
166
177
|
case 1:
|
|
167
178
|
_a.sent();
|
|
@@ -171,7 +182,7 @@ describe('Ov Icon tests', function () {
|
|
|
171
182
|
});
|
|
172
183
|
}); });
|
|
173
184
|
it('should call openEntity on click with correct entity uri if nonOvValues has items with entity uri', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
174
|
-
var attributeType, nonOvValues, props, user;
|
|
185
|
+
var attributeType, nonOvValues, props, mdmValues, user;
|
|
175
186
|
return __generator(this, function (_a) {
|
|
176
187
|
switch (_a.label) {
|
|
177
188
|
case 0:
|
|
@@ -181,7 +192,16 @@ describe('Ov Icon tests', function () {
|
|
|
181
192
|
{ value: 43, uri: 'entities/123/attributes/345' }
|
|
182
193
|
];
|
|
183
194
|
props = { attributeType: attributeType, nonOvValues: nonOvValues, nonOvTotal: nonOvValues.length };
|
|
184
|
-
|
|
195
|
+
mdmValues = {
|
|
196
|
+
uiConfigProfile: [
|
|
197
|
+
{
|
|
198
|
+
class: 'Sources',
|
|
199
|
+
label: 'Sources',
|
|
200
|
+
visible: ['configuration/entityTypes/HCO']
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
};
|
|
204
|
+
user = setUp({ props: props, mdmValues: mdmValues }).user;
|
|
185
205
|
return [4 /*yield*/, user.click(screen.getByText('+ 2'))];
|
|
186
206
|
case 1:
|
|
187
207
|
_a.sent();
|
|
@@ -190,4 +210,58 @@ describe('Ov Icon tests', function () {
|
|
|
190
210
|
}
|
|
191
211
|
});
|
|
192
212
|
}); });
|
|
213
|
+
it('should call openEntity on click with correct entity uri if attribute is a sub attribute of reference attribute', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
214
|
+
var entity, attributeType, nonOvValues, props, mdmValues, user;
|
|
215
|
+
return __generator(this, function (_a) {
|
|
216
|
+
switch (_a.label) {
|
|
217
|
+
case 0:
|
|
218
|
+
entity = {
|
|
219
|
+
uri: 'entities/246',
|
|
220
|
+
type: 'configuration/entityTypes/HCP',
|
|
221
|
+
attributes: {
|
|
222
|
+
Affiliations: [
|
|
223
|
+
{
|
|
224
|
+
label: 'Francis Luna',
|
|
225
|
+
uri: 'entities/246/attributes/Affiliations/04cbsvm',
|
|
226
|
+
refEntity: {
|
|
227
|
+
objectURI: 'entities/123',
|
|
228
|
+
type: 'configuration/entityTypes/HCA'
|
|
229
|
+
},
|
|
230
|
+
refRelation: {},
|
|
231
|
+
value: {}
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
attributeType = {
|
|
237
|
+
type: 'String',
|
|
238
|
+
name: 'String',
|
|
239
|
+
uri: 'configuration/entityTypes/HCA/attributes/CountryCode'
|
|
240
|
+
};
|
|
241
|
+
nonOvValues = [
|
|
242
|
+
{
|
|
243
|
+
value: 42,
|
|
244
|
+
uri: 'entities/246/attributes/Affiliations/04cbsvm/CountryCode/3TyGUD0Mq',
|
|
245
|
+
type: 'configuration/entityTypes/HCA/attributes/CountryCode'
|
|
246
|
+
}
|
|
247
|
+
];
|
|
248
|
+
props = { attributeType: attributeType, nonOvValues: nonOvValues, nonOvTotal: nonOvValues.length };
|
|
249
|
+
mdmValues = {
|
|
250
|
+
uiConfigProfile: [
|
|
251
|
+
{
|
|
252
|
+
class: 'Sources',
|
|
253
|
+
label: 'Sources',
|
|
254
|
+
visible: ['configuration/entityTypes/HCA']
|
|
255
|
+
}
|
|
256
|
+
]
|
|
257
|
+
};
|
|
258
|
+
user = setUp({ props: props, entityContextValue: entity, mdmValues: mdmValues }).user;
|
|
259
|
+
return [4 /*yield*/, user.click(screen.getByText('+ 1'))];
|
|
260
|
+
case 1:
|
|
261
|
+
_a.sent();
|
|
262
|
+
expect(openEntity).toHaveBeenCalledWith({ uri: 'entities/123', screen: 'sources' });
|
|
263
|
+
return [2 /*return*/];
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}); });
|
|
193
267
|
});
|
package/esm/OvIcon/helpers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Entity, NestedAttributeValue, ReferenceAttributeValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
1
|
+
import { Entity, NestedAttributeValue, ReferenceAttributeValue, SimpleAttributeValue, AttributeType } from '@reltio/mdm-sdk';
|
|
2
2
|
type NonOvValues = Array<SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue>;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const getLinkedEntity: (entity: Entity, nonOvValues: NonOvValues, attributeType: AttributeType) => Entity;
|
|
4
4
|
export {};
|
package/esm/OvIcon/helpers.js
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
|
-
import { getEntityUriFromAttributeUri, isEntityUri } from '@reltio/mdm-sdk';
|
|
2
|
-
export var
|
|
1
|
+
import { getEntityUriFromAttributeUri, isEntityUri, getParentUri, findAttributeValueByUri, getReferencedEntityUriFromAttrValue } from '@reltio/mdm-sdk';
|
|
2
|
+
export var getLinkedEntity = function (entity, nonOvValues, attributeType) {
|
|
3
3
|
var _a;
|
|
4
4
|
var attributeUri = (_a = nonOvValues === null || nonOvValues === void 0 ? void 0 : nonOvValues[0]) === null || _a === void 0 ? void 0 : _a.uri;
|
|
5
5
|
var entityOrRelationUri = attributeUri ? getEntityUriFromAttributeUri(attributeUri) : null;
|
|
6
|
-
|
|
6
|
+
if (entityOrRelationUri && isEntityUri(entityOrRelationUri)) {
|
|
7
|
+
var entityType = getEntityUriFromAttributeUri(attributeType.uri);
|
|
8
|
+
if (!entity || entity.type === entityType) {
|
|
9
|
+
return {
|
|
10
|
+
uri: entityOrRelationUri,
|
|
11
|
+
type: entityType
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
var parentAttributeUri = getParentUri(attributeUri);
|
|
15
|
+
var parentAttribute = findAttributeValueByUri(entity, parentAttributeUri);
|
|
16
|
+
return {
|
|
17
|
+
uri: getReferencedEntityUriFromAttrValue(parentAttribute),
|
|
18
|
+
type: entityType
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return entity
|
|
23
|
+
? {
|
|
24
|
+
uri: entity.uri,
|
|
25
|
+
type: entity.type
|
|
26
|
+
}
|
|
27
|
+
: null;
|
|
28
|
+
}
|
|
7
29
|
};
|
|
@@ -2,14 +2,17 @@ import React from 'react';
|
|
|
2
2
|
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
|
|
3
3
|
import { ReadOnlyAttributeValuesBlock } from '../../../../ReadOnlyAttributeValuesBlock';
|
|
4
4
|
import AttributeTitle from '../../../Title/Title';
|
|
5
|
+
import { EntityContext, useMdmEntity } from '../../../../contexts';
|
|
5
6
|
import { useStyles } from './styles';
|
|
6
7
|
var OvValuesRenderer = function (_a) {
|
|
7
8
|
var _b = _a.value, values = _b.values, attributeType = _b.attributeType, someRowIsDragging = _a.someRowIsDragging, dragRef = _a.dragRef;
|
|
8
9
|
var styles = useStyles();
|
|
10
|
+
var entity = useMdmEntity();
|
|
9
11
|
return (React.createElement("div", { className: styles.cellValueWrapper },
|
|
10
12
|
React.createElement("div", { ref: dragRef, className: styles.dragIndicator },
|
|
11
13
|
React.createElement(DragIndicatorIcon, { className: styles.dragIndicatorIcon })),
|
|
12
14
|
React.createElement(AttributeTitle, { className: styles.attributeTitle, label: attributeType.label }),
|
|
13
|
-
!someRowIsDragging && (React.createElement(
|
|
15
|
+
!someRowIsDragging && (React.createElement(EntityContext.Provider, { value: entity },
|
|
16
|
+
React.createElement(ReadOnlyAttributeValuesBlock, { values: values, attributeType: attributeType, valueContainerClassName: styles.ovValue })))));
|
|
14
17
|
};
|
|
15
18
|
export default OvValuesRenderer;
|
|
@@ -50,6 +50,7 @@ export declare const useMdmSearchProviderData: () => import("@reltio/mdm-sdk").S
|
|
|
50
50
|
export declare const useMdmIsCollaborationEnabled: () => boolean;
|
|
51
51
|
export declare const useMdmIsWorkflowEnabled: () => boolean;
|
|
52
52
|
export declare const useMdmProfileErrors: () => import("@reltio/mdm-sdk").AttributeError[];
|
|
53
|
+
export declare const useMdmIsSourcesScreenEnabled: (entityTypeUri: string) => boolean;
|
|
53
54
|
export declare const useMdmModifiedEntityDefaultProfilePic: (entityUri: string) => string;
|
|
54
55
|
export declare const useMdmModifiedEntity: (entityUri: string) => import("@reltio/mdm-sdk").Entity;
|
|
55
56
|
export declare const useMdmInitialConnectionTempEntity: (viewId: string, relationUri: string) => any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContextSelector } from '@fluentui/react-context-selector';
|
|
2
|
-
import { isEditableMode as checkIsEditableMode, isViewMode as checkIsViewMode, getDependentLookupsStructureNode, getDependentLookupEditorState, getAllRelationsToAddAndEdit, getInitialConnection, getInitialConnectionTempEntity, getCachedActiveErrorsForAttributesPager, getGlobalSearchRequestOptions, getDraftsByViewId, getAuthoringItemsFromLayoutByEntityType } from '@reltio/mdm-sdk';
|
|
2
|
+
import { isEditableMode as checkIsEditableMode, isViewMode as checkIsViewMode, getDependentLookupsStructureNode, getDependentLookupEditorState, getAllRelationsToAddAndEdit, getInitialConnection, getInitialConnectionTempEntity, getCachedActiveErrorsForAttributesPager, getGlobalSearchRequestOptions, getDraftsByViewId, getAuthoringItemsFromLayoutByEntityType, checkProfileScreenIsEnabled, ScreenType } from '@reltio/mdm-sdk';
|
|
3
3
|
import { MdmModuleActionsContext, MdmModuleListenersContext, MdmModuleValuesContext } from './context';
|
|
4
4
|
import { getDependentLookupEditorContext } from './selectors/dependentLookupEditorContext';
|
|
5
5
|
import { getModifiedEntity, getModifiedEntityDefaultProfilePic } from './selectors/entity';
|
|
@@ -75,6 +75,11 @@ export var useMdmIsCollaborationEnabled = function () {
|
|
|
75
75
|
};
|
|
76
76
|
export var useMdmIsWorkflowEnabled = function () { return useMdmModuleValuesContext(function (context) { return context.isWorkflowEnabled; }); };
|
|
77
77
|
export var useMdmProfileErrors = function () { return useMdmModuleValuesContext(function (context) { return context.profileErrors; }); };
|
|
78
|
+
export var useMdmIsSourcesScreenEnabled = function (entityTypeUri) {
|
|
79
|
+
return useMdmModuleValuesContext(function (context) {
|
|
80
|
+
return checkProfileScreenIsEnabled(context.uiConfigProfile, ScreenType.Sources, entityTypeUri);
|
|
81
|
+
});
|
|
82
|
+
};
|
|
78
83
|
export var useMdmModifiedEntityDefaultProfilePic = function (entityUri) {
|
|
79
84
|
return useMdmModuleValuesContext(function (context) {
|
|
80
85
|
return getModifiedEntityDefaultProfilePic(context.modifiedEntities, entityUri);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { MdmModuleProvider } from './provider';
|
|
2
|
-
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener } from './hooks';
|
|
2
|
+
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled } from './hooks';
|
|
3
3
|
export type { MdmModuleActionsContextProps, MdmModuleValuesContextProps, MdmModuleListenersContextProps } from './context';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { MdmModuleProvider } from './provider';
|
|
2
|
-
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener } from './hooks';
|
|
2
|
+
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled } from './hooks';
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1783",
|
|
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.1755",
|
|
11
11
|
"classnames": "^2.2.5",
|
|
12
12
|
"d3-cloud": "^1.2.5",
|
|
13
13
|
"d3-geo": "^2.0.1",
|