@reltio/components 1.4.2142 → 1.4.2144
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/contexts/RelationContext/index.d.ts +3 -0
- package/cjs/contexts/RelationContext/index.js +9 -0
- package/cjs/hooks/useMaskedAttribute/useMaskedAttribute.js +3 -1
- package/cjs/hooks/useRelationsLoader/useRelationsLoader.js +1 -5
- package/cjs/hooks/useRelationsLoader/useRelationsLoader.test.js +81 -54
- package/cjs/hooks/useSegmentsLoader/useSegmentsLoader.js +2 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +5 -3
- package/contexts/RelationContext/index.d.ts +3 -0
- package/contexts/RelationContext/index.js +3 -0
- package/hooks/useMaskedAttribute/useMaskedAttribute.js +3 -1
- package/hooks/useRelationsLoader/useRelationsLoader.js +2 -6
- package/hooks/useRelationsLoader/useRelationsLoader.test.js +81 -54
- package/hooks/useSegmentsLoader/useSegmentsLoader.js +3 -2
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RelationContext = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
exports.RelationContext = react_1.default.createContext(null);
|
|
9
|
+
exports.RelationContext.displayName = 'RelationContext';
|
|
@@ -40,6 +40,7 @@ exports.useMaskedAttribute = void 0;
|
|
|
40
40
|
var react_1 = require("react");
|
|
41
41
|
var MdmModuleContext_1 = require("../../contexts/MdmModuleContext");
|
|
42
42
|
var EntityContext_1 = require("../../contexts/EntityContext");
|
|
43
|
+
var RelationContext_1 = require("../../contexts/RelationContext");
|
|
43
44
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
44
45
|
var MaskedAttributesContext_1 = require("../../contexts/MaskedAttributesContext");
|
|
45
46
|
var helpers_1 = require("./helpers");
|
|
@@ -51,11 +52,12 @@ var useMaskedAttribute = function (_a) {
|
|
|
51
52
|
var metadata = (0, MdmModuleContext_1.useMdmMetadata)();
|
|
52
53
|
var showMasking = (0, MdmModuleContext_1.useMdmShowMasking)();
|
|
53
54
|
var entityFromContext = (0, react_1.useContext)(EntityContext_1.EntityContext);
|
|
55
|
+
var relation = (0, react_1.useContext)(RelationContext_1.RelationContext);
|
|
54
56
|
var mainEntity = (0, MdmModuleContext_1.useMdmEntity)();
|
|
55
57
|
var entity = entityProp || entityFromContext || mainEntity;
|
|
56
58
|
var canUnmaskAttribute = (0, mdm_sdk_1.checkCanUnmaskAttribute)(attributeType);
|
|
57
59
|
var isRelationAttribute = (0, mdm_sdk_1.isRelationUri)(attributeValue.uri);
|
|
58
|
-
var hasUnmaskDataPermissions =
|
|
60
|
+
var hasUnmaskDataPermissions = (0, mdm_sdk_1.checkDataPermissionsToUnmask)(isRelationAttribute ? relation : entity);
|
|
59
61
|
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;
|
|
60
62
|
var isUnmaskingNeeded = unmaskAttributeValue &&
|
|
61
63
|
maskAttributeValue &&
|
|
@@ -57,11 +57,7 @@ var useRelationsLoader = function (_a) {
|
|
|
57
57
|
var suggested = config.suggested;
|
|
58
58
|
var options = (0, react_1.useMemo)(function () {
|
|
59
59
|
var sendMasked = showMasking && (0, mdm_sdk_1.hasRelationMasking)(metadata) && mode === mdm_sdk_1.Mode.Viewing;
|
|
60
|
-
return {
|
|
61
|
-
searchByOv: searchByOv,
|
|
62
|
-
sendMasked: sendMasked,
|
|
63
|
-
searchRelationsWithFilter: searchRelationsWithFilter
|
|
64
|
-
};
|
|
60
|
+
return (0, mdm_sdk_1.addRelationMaskingOptions)({ searchByOv: searchByOv, searchRelationsWithFilter: searchRelationsWithFilter }, sendMasked);
|
|
65
61
|
}, [searchByOv, showMasking, metadata, mode, searchRelationsWithFilter]);
|
|
66
62
|
var filters = (0, react_1.useMemo)(function () {
|
|
67
63
|
var _a;
|
|
@@ -112,9 +112,8 @@ var setUp = function (_a) {
|
|
|
112
112
|
};
|
|
113
113
|
return __assign(__assign({}, (0, react_hooks_1.renderHook)(useRelationsLoader_1.useRelationsLoader, { initialProps: props, wrapper: Providers })), { updateMdmValues: updateMdmValues });
|
|
114
114
|
};
|
|
115
|
-
var createMetadata = function (
|
|
116
|
-
|
|
117
|
-
if (relationAccess === void 0) { relationAccess = []; }
|
|
115
|
+
var createMetadata = function (_a) {
|
|
116
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.entityAccess, entityAccess = _c === void 0 ? [] : _c, _d = _b.relationAccess, relationAccess = _d === void 0 ? [] : _d, _e = _b.masking, masking = _e === void 0 ? false : _e;
|
|
118
117
|
return {
|
|
119
118
|
entityTypes: [
|
|
120
119
|
{
|
|
@@ -136,15 +135,17 @@ var createMetadata = function (entityAccess, relationAccess) {
|
|
|
136
135
|
],
|
|
137
136
|
relationTypes: [
|
|
138
137
|
{
|
|
139
|
-
uri: 'configuration/
|
|
138
|
+
uri: 'configuration/relationTypes/HCPtoHCA',
|
|
140
139
|
label: 'HCP2HCA',
|
|
141
140
|
access: ['DELETE', 'READ', 'CREATE', 'UPDATE'],
|
|
142
|
-
attributes: [
|
|
141
|
+
attributes: [
|
|
142
|
+
__assign({ uri: 'configuration/relationTypes/HCPtoHCA/attributes/AddressRank', label: 'AddressRank', type: 'String', description: 'Address rank', name: 'AddressRank' }, (masking && { masking: { regexPattern: '.*' } }))
|
|
143
|
+
],
|
|
143
144
|
abstract: false,
|
|
144
145
|
businessCardAttributeURIs: []
|
|
145
146
|
},
|
|
146
147
|
{
|
|
147
|
-
uri: 'configuration/
|
|
148
|
+
uri: 'configuration/relationTypes/HCPtoHCP',
|
|
148
149
|
label: 'HCP',
|
|
149
150
|
access: relationAccess,
|
|
150
151
|
attributes: [],
|
|
@@ -172,7 +173,7 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
172
173
|
return __generator(this, function (_b) {
|
|
173
174
|
switch (_b.label) {
|
|
174
175
|
case 0:
|
|
175
|
-
metadata = createMetadata(['DELETE', 'READ', 'CREATE', 'UPDATE']);
|
|
176
|
+
metadata = createMetadata({ entityAccess: ['DELETE', 'READ', 'CREATE', 'UPDATE'] });
|
|
176
177
|
mdmValues = __assign(__assign({}, defaultMdmValues), { metadata: metadata });
|
|
177
178
|
_a = setUp({ mdmValues: mdmValues }), result = _a.result, waitFor = _a.waitFor;
|
|
178
179
|
(0, react_hooks_1.act)(function () {
|
|
@@ -197,7 +198,7 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
197
198
|
return __generator(this, function (_b) {
|
|
198
199
|
switch (_b.label) {
|
|
199
200
|
case 0:
|
|
200
|
-
metadata = createMetadata(['DELETE', 'READ', 'CREATE', 'UPDATE']);
|
|
201
|
+
metadata = createMetadata({ entityAccess: ['DELETE', 'READ', 'CREATE', 'UPDATE'] });
|
|
201
202
|
mdmValues = __assign(__assign({}, defaultMdmValues), { metadata: metadata });
|
|
202
203
|
_a = setUp({ mdmValues: mdmValues }), result = _a.result, waitFor = _a.waitFor, updateMdmValues = _a.updateMdmValues;
|
|
203
204
|
reloadFirst = result.current.reload;
|
|
@@ -220,18 +221,18 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
220
221
|
return __generator(this, function (_b) {
|
|
221
222
|
switch (_b.label) {
|
|
222
223
|
case 0:
|
|
223
|
-
metadata = createMetadata(['DELETE', 'READ', 'CREATE', 'UPDATE']);
|
|
224
|
+
metadata = createMetadata({ entityAccess: ['DELETE', 'READ', 'CREATE', 'UPDATE'] });
|
|
224
225
|
config = {
|
|
225
226
|
id: 'id',
|
|
226
227
|
content: {
|
|
227
228
|
inRelations: [
|
|
228
|
-
{ uri: 'configuration/
|
|
229
|
-
'configuration/
|
|
229
|
+
{ uri: 'configuration/relationTypes/HCPtoHCA', label: 'HCP2HCA' },
|
|
230
|
+
'configuration/relationTypes/HCPtoHCP'
|
|
230
231
|
],
|
|
231
232
|
entityTypes: ['configuration/entityTypes/HCP', 'configuration/entityTypes/HCA'],
|
|
232
233
|
outRelations: [
|
|
233
|
-
{ uri: 'configuration/
|
|
234
|
-
'configuration/
|
|
234
|
+
{ uri: 'configuration/relationTypes/HCPtoHCP', label: 'HCP' },
|
|
235
|
+
'configuration/relationTypes/HCPtoHCA'
|
|
235
236
|
]
|
|
236
237
|
}
|
|
237
238
|
};
|
|
@@ -242,17 +243,14 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
242
243
|
{
|
|
243
244
|
activeness: { entity: 'all', relation: 'all' },
|
|
244
245
|
entityTypes: ['configuration/entityTypes/HCP', 'configuration/entityTypes/HCA'],
|
|
245
|
-
inRelations: [{ label: 'HCP2HCA', uri: 'configuration/
|
|
246
|
+
inRelations: [{ label: 'HCP2HCA', uri: 'configuration/relationTypes/HCPtoHCA' }],
|
|
246
247
|
max: 1,
|
|
247
248
|
offset: 0,
|
|
248
|
-
outRelations: ['configuration/
|
|
249
|
+
outRelations: ['configuration/relationTypes/HCPtoHCA'],
|
|
249
250
|
returnDates: true,
|
|
250
251
|
returnObjects: true
|
|
251
252
|
}
|
|
252
|
-
], {
|
|
253
|
-
searchByOv: false,
|
|
254
|
-
sendMasked: false
|
|
255
|
-
});
|
|
253
|
+
], { searchByOv: false });
|
|
256
254
|
return [4 /*yield*/, waitFor(function () { return expect(result.current.isLoading).toBe(false); })];
|
|
257
255
|
case 1:
|
|
258
256
|
_b.sent();
|
|
@@ -271,28 +269,28 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
271
269
|
content: {
|
|
272
270
|
inRelations: [
|
|
273
271
|
{
|
|
274
|
-
uri: 'configuration/
|
|
272
|
+
uri: 'configuration/relationTypes/HCPtoHCA',
|
|
275
273
|
label: 'HCP2HCA'
|
|
276
274
|
},
|
|
277
|
-
'configuration/
|
|
275
|
+
'configuration/relationTypes/HCPtoHCP'
|
|
278
276
|
],
|
|
279
277
|
entityTypes: ['configuration/entityTypes/HCP', 'configuration/entityTypes/HCA'],
|
|
280
278
|
outRelations: [
|
|
281
|
-
{ uri: 'configuration/
|
|
282
|
-
'configuration/
|
|
279
|
+
{ uri: 'configuration/relationTypes/HCPtoHCP', label: 'HCP' },
|
|
280
|
+
'configuration/relationTypes/HCPtoHCA'
|
|
283
281
|
],
|
|
284
282
|
nextEntry: {
|
|
285
283
|
inRelations: [
|
|
286
284
|
{
|
|
287
|
-
uri: 'configuration/
|
|
285
|
+
uri: 'configuration/relationTypes/HCPtoHCA',
|
|
288
286
|
label: 'HCP2HCA'
|
|
289
287
|
},
|
|
290
|
-
'configuration/
|
|
288
|
+
'configuration/relationTypes/HCPtoHCP'
|
|
291
289
|
],
|
|
292
290
|
entityTypes: ['configuration/entityTypes/HCP', 'configuration/entityTypes/HCA'],
|
|
293
291
|
outRelations: [
|
|
294
|
-
{ uri: 'configuration/
|
|
295
|
-
'configuration/
|
|
292
|
+
{ uri: 'configuration/relationTypes/HCPtoHCP', label: 'HCP' },
|
|
293
|
+
'configuration/relationTypes/HCPtoHCA'
|
|
296
294
|
]
|
|
297
295
|
}
|
|
298
296
|
}
|
|
@@ -304,10 +302,10 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
304
302
|
{
|
|
305
303
|
activeness: { entity: 'all', relation: 'all' },
|
|
306
304
|
entityTypes: ['configuration/entityTypes/HCA'],
|
|
307
|
-
inRelations: [{ label: 'HCP2HCA', uri: 'configuration/
|
|
305
|
+
inRelations: [{ label: 'HCP2HCA', uri: 'configuration/relationTypes/HCPtoHCA' }],
|
|
308
306
|
max: 1,
|
|
309
307
|
offset: 0,
|
|
310
|
-
outRelations: ['configuration/
|
|
308
|
+
outRelations: ['configuration/relationTypes/HCPtoHCA'],
|
|
311
309
|
returnDates: true,
|
|
312
310
|
returnObjects: true,
|
|
313
311
|
nextEntry: {
|
|
@@ -315,16 +313,13 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
315
313
|
inRelations: [
|
|
316
314
|
{
|
|
317
315
|
label: 'HCP2HCA',
|
|
318
|
-
uri: 'configuration/
|
|
316
|
+
uri: 'configuration/relationTypes/HCPtoHCA'
|
|
319
317
|
}
|
|
320
318
|
],
|
|
321
|
-
outRelations: ['configuration/
|
|
319
|
+
outRelations: ['configuration/relationTypes/HCPtoHCA']
|
|
322
320
|
}
|
|
323
321
|
}
|
|
324
|
-
], {
|
|
325
|
-
searchByOv: false,
|
|
326
|
-
sendMasked: false
|
|
327
|
-
});
|
|
322
|
+
], { searchByOv: false });
|
|
328
323
|
return [4 /*yield*/, waitFor(function () { return expect(result.current.isLoading).toBe(false); })];
|
|
329
324
|
case 1:
|
|
330
325
|
_b.sent();
|
|
@@ -343,28 +338,28 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
343
338
|
content: {
|
|
344
339
|
inRelations: [
|
|
345
340
|
{
|
|
346
|
-
uri: 'configuration/
|
|
341
|
+
uri: 'configuration/relationTypes/HCPtoHCA',
|
|
347
342
|
label: 'HCP2HCA'
|
|
348
343
|
},
|
|
349
|
-
'configuration/
|
|
344
|
+
'configuration/relationTypes/HCPtoHCP'
|
|
350
345
|
],
|
|
351
346
|
entityTypes: ['configuration/entityTypes/HCA'],
|
|
352
347
|
outRelations: [
|
|
353
|
-
{ uri: 'configuration/
|
|
354
|
-
'configuration/
|
|
348
|
+
{ uri: 'configuration/relationTypes/HCPtoHCP', label: 'HCP' },
|
|
349
|
+
'configuration/relationTypes/HCPtoHCA'
|
|
355
350
|
],
|
|
356
351
|
nextEntry: {
|
|
357
352
|
inRelations: [
|
|
358
353
|
{
|
|
359
|
-
uri: 'configuration/
|
|
354
|
+
uri: 'configuration/relationTypes/HCPtoHCA',
|
|
360
355
|
label: 'HCP2HCA'
|
|
361
356
|
},
|
|
362
|
-
'configuration/
|
|
357
|
+
'configuration/relationTypes/HCPtoHCP'
|
|
363
358
|
],
|
|
364
359
|
entityTypes: ['configuration/entityTypes/HCP'],
|
|
365
360
|
outRelations: [
|
|
366
|
-
{ uri: 'configuration/
|
|
367
|
-
'configuration/
|
|
361
|
+
{ uri: 'configuration/relationTypes/HCPtoHCP', label: 'HCP' },
|
|
362
|
+
'configuration/relationTypes/HCPtoHCA'
|
|
368
363
|
]
|
|
369
364
|
}
|
|
370
365
|
}
|
|
@@ -391,15 +386,15 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
391
386
|
content: {
|
|
392
387
|
inRelations: [
|
|
393
388
|
{
|
|
394
|
-
uri: 'configuration/
|
|
389
|
+
uri: 'configuration/relationTypes/HCPtoHCA',
|
|
395
390
|
label: 'HCP2HCA'
|
|
396
391
|
},
|
|
397
|
-
'configuration/
|
|
392
|
+
'configuration/relationTypes/HCPtoHCP'
|
|
398
393
|
],
|
|
399
394
|
entityTypes: ['configuration/entityTypes/HCP'],
|
|
400
395
|
outRelations: [
|
|
401
|
-
{ uri: 'configuration/
|
|
402
|
-
'configuration/
|
|
396
|
+
{ uri: 'configuration/relationTypes/HCPtoHCP', label: 'HCP' },
|
|
397
|
+
'configuration/relationTypes/HCPtoHCA'
|
|
403
398
|
]
|
|
404
399
|
}
|
|
405
400
|
};
|
|
@@ -425,14 +420,14 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
425
420
|
content: {
|
|
426
421
|
inRelations: [
|
|
427
422
|
{
|
|
428
|
-
uri: 'configuration/
|
|
423
|
+
uri: 'configuration/relationTypes/HCPtoHCA',
|
|
429
424
|
label: 'HCP2HCA'
|
|
430
425
|
},
|
|
431
|
-
'configuration/
|
|
426
|
+
'configuration/relationTypes/HCPtoHCP'
|
|
432
427
|
],
|
|
433
428
|
outRelations: [
|
|
434
|
-
{ uri: 'configuration/
|
|
435
|
-
'configuration/
|
|
429
|
+
{ uri: 'configuration/relationTypes/HCPtoHCP', label: 'HCP' },
|
|
430
|
+
'configuration/relationTypes/HCPtoHCA'
|
|
436
431
|
]
|
|
437
432
|
}
|
|
438
433
|
};
|
|
@@ -442,16 +437,48 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
442
437
|
expect(mdm_sdk_1.getRelationsForEntity).toHaveBeenCalledWith('123', [
|
|
443
438
|
{
|
|
444
439
|
activeness: { entity: 'all', relation: 'all' },
|
|
445
|
-
inRelations: [{ label: 'HCP2HCA', uri: 'configuration/
|
|
440
|
+
inRelations: [{ label: 'HCP2HCA', uri: 'configuration/relationTypes/HCPtoHCA' }],
|
|
441
|
+
max: 1,
|
|
442
|
+
offset: 0,
|
|
443
|
+
outRelations: ['configuration/relationTypes/HCPtoHCA'],
|
|
444
|
+
returnDates: true,
|
|
445
|
+
returnObjects: true
|
|
446
|
+
}
|
|
447
|
+
], { searchByOv: false });
|
|
448
|
+
return [4 /*yield*/, waitFor(function () { return expect(result.current.isLoading).toBe(false); })];
|
|
449
|
+
case 1:
|
|
450
|
+
_b.sent();
|
|
451
|
+
return [2 /*return*/];
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
}); });
|
|
455
|
+
});
|
|
456
|
+
describe('masking behaviour', function () {
|
|
457
|
+
it('should send correct masking options if relation has masking', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
458
|
+
var metadata, mdmValues, _a, result, waitFor;
|
|
459
|
+
return __generator(this, function (_b) {
|
|
460
|
+
switch (_b.label) {
|
|
461
|
+
case 0:
|
|
462
|
+
metadata = createMetadata({ masking: true });
|
|
463
|
+
mdmValues = __assign(__assign({}, defaultMdmValues), { metadata: metadata });
|
|
464
|
+
_a = setUp({ mdmValues: mdmValues }), result = _a.result, waitFor = _a.waitFor;
|
|
465
|
+
(0, react_hooks_1.act)(function () {
|
|
466
|
+
result.current.reload();
|
|
467
|
+
});
|
|
468
|
+
expect(mdm_sdk_1.getRelationsForEntity).toHaveBeenCalledWith('123', [
|
|
469
|
+
{
|
|
470
|
+
activeness: { entity: 'all', relation: 'all' },
|
|
471
|
+
inRelations: [],
|
|
446
472
|
max: 1,
|
|
447
473
|
offset: 0,
|
|
448
|
-
outRelations: [
|
|
474
|
+
outRelations: [],
|
|
449
475
|
returnDates: true,
|
|
450
476
|
returnObjects: true
|
|
451
477
|
}
|
|
452
478
|
], {
|
|
453
479
|
searchByOv: false,
|
|
454
|
-
sendMasked:
|
|
480
|
+
sendMasked: true,
|
|
481
|
+
showAccess: true
|
|
455
482
|
});
|
|
456
483
|
return [4 /*yield*/, waitFor(function () { return expect(result.current.isLoading).toBe(false); })];
|
|
457
484
|
case 1:
|
|
@@ -60,8 +60,9 @@ var useSegmentsLoader = function (_a) {
|
|
|
60
60
|
var _c = (0, react_1.useState)([]), segments = _c[0], setSegments = _c[1];
|
|
61
61
|
var _d = (0, react_1.useState)(0), total = _d[0], setTotal = _d[1];
|
|
62
62
|
var _e = sorting || {}, sort = _e.field, order = _e.order;
|
|
63
|
-
var filterString = (0, segments_1.buildSegmentsFilterString)(filters);
|
|
64
63
|
var hasActiveFilter = (0, segments_1.isActiveFilter)(filters !== null && filters !== void 0 ? filters : {});
|
|
64
|
+
var hasSearchValue = Boolean((filters === null || filters === void 0 ? void 0 : filters.searchValue) && filters.searchValue.length > 0);
|
|
65
|
+
var filterString = (0, segments_1.buildSegmentsFilterString)(__assign(__assign({}, filters), (hasActiveFilter && !hasSearchValue ? { itemType: mdm_sdk_1.NewSegmentItemType.Segment } : {})));
|
|
65
66
|
var params = (0, react_1.useMemo)(function () {
|
|
66
67
|
return (0, ramda_1.reject)(mdm_sdk_1.isEmptyValue, __assign(__assign({ sort: sort, order: order, max: rowsPerPage, offset: page * rowsPerPage, filter: filterString }, (parentId && !hasActiveFilter ? { parentId: parentId } : {})), (hasActiveFilter ? { fetchAll: true } : {})));
|
|
67
68
|
}, [sort, order, rowsPerPage, page, filterString, parentId, hasActiveFilter]);
|
package/cjs/index.d.ts
CHANGED
|
@@ -214,6 +214,7 @@ export { EntityLoadingIndicationProvider, useEntityLoadingIndication } from './c
|
|
|
214
214
|
export { WorkflowTasksContext } from './contexts/WorkflowTasksContext';
|
|
215
215
|
export { RelatedObjectUrisContext } from './contexts/RelatedObjectUrisContext';
|
|
216
216
|
export { EntityContext } from './contexts/EntityContext';
|
|
217
|
+
export { RelationContext } from './contexts/RelationContext';
|
|
217
218
|
export { SandboxAPIContext } from './contexts/SandboxAPIContext';
|
|
218
219
|
export { useReloadAllFacets, ReloadFacetProvider, useReloadFacet } from './contexts/ReloadFacetContext';
|
|
219
220
|
export { SearchFiltersContext } from './contexts/SearchFiltersContext';
|
package/cjs/index.js
CHANGED
|
@@ -18,9 +18,9 @@ exports.NestedAttributeEditor = exports.NestedAttribute = exports.MoreAttributes
|
|
|
18
18
|
exports.DropDownSelector = exports.ReactSelectOptionWithCheckIcon = exports.ReactSelectMenuWithPopper = exports.ReactSelectMenuList = exports.ReactSelectLoadMoreButton = exports.ReactSelectDropdownIndicatorWithIconButton = exports.ReactSelectDropdownIndicator = exports.Highlighter = exports.HierarchyNodeTitle = exports.HierarchicalAttributeTooltip = exports.HideOnShrink = exports.ExpandableSearchInput = exports.ErrorPopup = exports.ErrorBoundary = exports.SegmentIdLink = exports.EntityUriLink = exports.EntityTypesSelector = exports.EntityTypeIcon = exports.EntityTypeBadge = exports.EntityAvatar = exports.EMPTY_STATE_VARIANTS = exports.EMPTY_STATE_ICONS = exports.EmptyState = exports.Drawer = exports.DataTypeValue = exports.DataTenantBadge = exports.ConnectionRelationTypeSelector = exports.CollaborationItem = exports.ConfirmationDialog = exports.CommentsContainer = exports.ColoredSourceIcon = exports.CollapseButton = exports.TreeChart = exports.TableWithBars = exports.SourceIcon = exports.SmallIconButtonWithTooltip = exports.SmallIconButton = exports.SimpleAttributeEditor = exports.SimpleAttribute = exports.RowCellAutoSizer = exports.RelationTypeSelector = exports.ReferenceAttributeEditor = exports.ReferenceAttribute = exports.ImageAttributesLine = exports.ReadOnlyAttributesPager = exports.ReadOnlyAttributesList = exports.ReadOnlyAttribute = exports.ReadOnlyAttributeValuesBlock = exports.PieChart = exports.OvIcon = void 0;
|
|
19
19
|
exports.SimpleMatchRulesBuilder = exports.SimpleMatchRulesBlock = exports.SimpleMatchRules = exports.MatchRulesBlock = exports.LoadingSpinner = exports.Link = exports.LinearLoadIndicator = exports.ImportButton = exports.ReadableSearchQueryBuilder = exports.ReadableSearchQuery = exports.LogicOperator = exports.TableSkeleton = exports.StepNavigation = exports.TenantLabel = exports.RelevanceScoreBadge = exports.RequiredMark = exports.SettingsMenu = exports.TenantsDropDownSelector = exports.TenantIcon = exports.SourceSystemsSelector = exports.MatchRulesSelector = exports.MultiValueSelector = exports.ProfilesList = exports.NotMatchButton = exports.MergeButton = exports.ProfileMatchCard = exports.ImageGalleryDialog = exports.RelationTypesSelector = exports.ScreenProfileBand = exports.ProfileBandNavigation = exports.EmptyStub = exports.MaskingSwitcher = exports.FileTypeEditor = exports.EmptySearchResult = exports.DropDownEditor = exports.FilterValueEditor = exports.MultiValueChip = exports.TextEditor = exports.DateRangeEditor = exports.NumberEditor = exports.DataTypeValueEditor = exports.DateEditor = exports.ErrorWrapper = exports.ErrorMessage = exports.HIDE = exports.INSERT_RIGHT = exports.INSERT_LEFT = exports.ConfigColumnPopup = exports.ConfigureColumnsPopup = exports.ConnectionEditor = void 0;
|
|
20
20
|
exports.withDateRangeSelector = exports.withDragHandle = exports.withAsyncMount = exports.withTooltip = exports.DefaultHeadCellRendererWithTooltip = exports.LazyRenderer = exports.MetadataTypesSelector = exports.DateRangeSelector = exports.UpSetChart = exports.GaugeChart = exports.RelationEditor = exports.ReltioMap = exports.Marginator = exports.LightArrowTooltip = exports.ScrollableTabs = exports.VirtualGroupedList = exports.ViewMoreToggle = exports.VerticalHeadingsTable = exports.VerticalDivider = exports.AttributeTitle = exports.Spacer = exports.SimpleDropDownSelector = exports.SidePanelContentHeader = exports.SidePanel = exports.SidePanelEmptyState = exports.SideButtonsPanel = exports.SelectorWithOnlyOptionAutoSelect = exports.SelectionPopup = exports.WhiteSearchInput = exports.SearchInput = exports.ProfileResizablePanes = exports.ResizablePanes = exports.ReltioGridLayout = exports.RCTreeSwitchRenderer = exports.RCTreeLevelLines = exports.RCTree = exports.reactSortableTreeHelpers = exports.ReactSortableTree = exports.MultiSelect = exports.QueryBuilderRowsGroup = exports.QueryBuilderRow = exports.ProfileCard = exports.ProfileBand = exports.PotentialMatchReviewCard = exports.PopupWithArrow = exports.Popper = exports.MultipleInput = exports.ModeSwitcherSelect = exports.ModeSwitcher = exports.TransitiveMatchBlock = void 0;
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.mockComputedStyles = exports.FakeMouseEvent = exports.rerenderWrapper = exports.mockElementSizes = exports.fixClicksOnResizablePanes = exports.mockBasicTableSizing = exports.getMuiIconsByName = exports.getMuiIconByName = exports.deepFreeze = exports.awaitMockPromises = exports.TestStylesProvider = exports.TestPerspectivesSettingsProvider = exports.getAttrPathFromColumnId = exports.getAttributeHeight = exports.getNestedPathByColumnId = exports.applyCompactValuesCountConstraint = exports.getAttributeSelectorItems = exports.mergeClasses = exports.isControlOrCommandPressed = exports.getValue = exports.getChecked = exports.showErrorMessage = exports.showDefaultErrorMessage = exports.enrichDataWithPercents = exports.defaultRenderRowCell = exports.defaultGetRowCellHeight = exports.columnFilterToMdmFilter = exports.buildColumnsSizeById = exports.buildColumnsFilter = exports.useSegmentsLoader = exports.useDndBasicTableScrollModifier = exports.useDynamicYAxisWidth = exports.useFilterAutoFocus = exports.useSegmentationRequest = exports.resolveMarkers = exports.useMarkers = exports.useMaskedAttribute = exports.useKeyboardNavigation = exports.useDynamicRowCellHeight = exports.useClickableStyle = exports.BasicTableCellRenderer = exports.useBasicTableCellRenderer = exports.useHiddenAttributes = exports.useSavedSearchesRequest = exports.useRequestDCRReview = exports.useAutoFocus = exports.useExpandInvalidRelations = void 0;
|
|
21
|
+
exports.isHighlightedErrorType = exports.ScrollType = exports.ScrollToElementProvider = exports.ScrollToElementContext = exports.SearchValueContext = exports.InterceptHandlersContext = exports.HighlightedValuesContext = exports.SnackbarContext = exports.SearchFiltersContext = exports.useReloadFacet = exports.ReloadFacetProvider = exports.useReloadAllFacets = exports.SandboxAPIContext = exports.RelationContext = exports.EntityContext = exports.RelatedObjectUrisContext = exports.WorkflowTasksContext = exports.useEntityLoadingIndication = exports.EntityLoadingIndicationProvider = exports.EntityMarkerContext = exports.useAttributeExpanded = exports.ExpandedAttributesProvider = exports.useHighlightedCrosswalks = exports.useCrosswalkHighlight = exports.useCrosswalkFocus = exports.useCrosswalkColor = exports.CrosswalksDisplayProvider = exports.EntitiesMapContext = exports.IdContext = exports.ProfilePerspectiveViewContext = exports.usePerspectivesSettings = exports.PerspectivesSettingsContext = exports.PivotingAttributeContext = exports.UsersContext = exports.InitialCollaborationContextValue = exports.CollaborationContextProvider = exports.CollaborationContext = exports.BlockNavigationContext = exports.BlockImageGalleryDialogContext = exports.PopupBoundariesContext = exports.HistoryDiffContext = exports.AsyncMountContext = exports.MdmModuleProvider = exports.withColumnConfigurator = exports.withBlockNavigation = exports.withCollapseButton = exports.withTableContext = exports.withFilterAtBottom = exports.withPercents = exports.withContext = void 0;
|
|
22
|
+
exports.useIsMountedRef = exports.useSnackbar = exports.useSavedStateForEntityType = exports.useReadableSearchState = exports.useEditableConnection = exports.useCustomScripts = exports.useMarkAsNotMatchRequest = exports.useMergeAllRequest = exports.usePagingSimulator = exports.useMatchesLoader = exports.useConfigPermissions = exports.useWhyDidYouUpdate = exports.useUsers = exports.useSavedState = exports.useSafePromise = exports.useRunOnceAfterValueInitialization = exports.useRelationsLoader = exports.useRelationTypeSelector = exports.usePrevious = exports.useDidUpdateEffect = exports.useCommentsEntitiesMap = exports.useCollaboration = exports.useAsyncMount = exports.useAPI = exports.useActions = exports.useMatchesColumnsData = exports.useScrollToAttributeError = exports.ThemeProvider = exports.ProfileTablesContext = exports.HiddenAttributesContext = exports.BasicTableContext = exports.BasicTableRowCollapseContext = exports.useDeleteUnmaskedAttributeForRelation = exports.useUnmaskedAttributeValue = exports.useUnmaskAttributeValue = exports.useMaskAttributeValue = exports.MaskedAttributesProvider = exports.useReloadData = exports.ReloadDataProvider = exports.useAttributeValueConfigPermissions = exports.ConfigPermissionsContextProvider = exports.ConfigPermissionsContext = exports.useActionsHook = exports.ActionsHookProvider = exports.PageRequestsAbortingContext = exports.DependentLookupAutopopulationContext = exports.FeaturesContext = exports.LabelsContext = exports.UrlGeneratorsContext = exports.isHighlightedAttributeType = void 0;
|
|
23
|
+
exports.mockComputedStyles = exports.FakeMouseEvent = exports.rerenderWrapper = exports.mockElementSizes = exports.fixClicksOnResizablePanes = exports.mockBasicTableSizing = exports.getMuiIconsByName = exports.getMuiIconByName = exports.deepFreeze = exports.awaitMockPromises = exports.TestStylesProvider = exports.TestPerspectivesSettingsProvider = exports.getAttrPathFromColumnId = exports.getAttributeHeight = exports.getNestedPathByColumnId = exports.applyCompactValuesCountConstraint = exports.getAttributeSelectorItems = exports.mergeClasses = exports.isControlOrCommandPressed = exports.getValue = exports.getChecked = exports.showErrorMessage = exports.showDefaultErrorMessage = exports.enrichDataWithPercents = exports.defaultRenderRowCell = exports.defaultGetRowCellHeight = exports.columnFilterToMdmFilter = exports.buildColumnsSizeById = exports.buildColumnsFilter = exports.useSegmentsLoader = exports.useDndBasicTableScrollModifier = exports.useDynamicYAxisWidth = exports.useFilterAutoFocus = exports.useSegmentationRequest = exports.resolveMarkers = exports.useMarkers = exports.useMaskedAttribute = exports.useKeyboardNavigation = exports.useDynamicRowCellHeight = exports.useClickableStyle = exports.BasicTableCellRenderer = exports.useBasicTableCellRenderer = exports.useHiddenAttributes = exports.useSavedSearchesRequest = exports.useRequestDCRReview = exports.useAutoFocus = exports.useExpandInvalidRelations = exports.useLayoutResetter = void 0;
|
|
24
24
|
// components
|
|
25
25
|
var ActionButton_1 = require("./ActionButton");
|
|
26
26
|
Object.defineProperty(exports, "ActionButton", { enumerable: true, get: function () { return ActionButton_1.ActionButton; } });
|
|
@@ -475,6 +475,8 @@ var RelatedObjectUrisContext_1 = require("./contexts/RelatedObjectUrisContext");
|
|
|
475
475
|
Object.defineProperty(exports, "RelatedObjectUrisContext", { enumerable: true, get: function () { return RelatedObjectUrisContext_1.RelatedObjectUrisContext; } });
|
|
476
476
|
var EntityContext_1 = require("./contexts/EntityContext");
|
|
477
477
|
Object.defineProperty(exports, "EntityContext", { enumerable: true, get: function () { return EntityContext_1.EntityContext; } });
|
|
478
|
+
var RelationContext_1 = require("./contexts/RelationContext");
|
|
479
|
+
Object.defineProperty(exports, "RelationContext", { enumerable: true, get: function () { return RelationContext_1.RelationContext; } });
|
|
478
480
|
var SandboxAPIContext_1 = require("./contexts/SandboxAPIContext");
|
|
479
481
|
Object.defineProperty(exports, "SandboxAPIContext", { enumerable: true, get: function () { return SandboxAPIContext_1.SandboxAPIContext; } });
|
|
480
482
|
var ReloadFacetContext_1 = require("./contexts/ReloadFacetContext");
|
|
@@ -37,6 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
import { useCallback, useContext } from 'react';
|
|
38
38
|
import { useMdmIsViewMode, useMdmEntity, useMdmMetadata, useMdmShowMasking } from '../../contexts/MdmModuleContext';
|
|
39
39
|
import { EntityContext } from '../../contexts/EntityContext';
|
|
40
|
+
import { RelationContext } from '../../contexts/RelationContext';
|
|
40
41
|
import { checkCanUnmaskAttribute, checkDataPermissionsToUnmask, isRelationUri } from '@reltio/mdm-sdk';
|
|
41
42
|
import { useMaskAttributeValue, useUnmaskAttributeValue, useUnmaskedAttributeValue } from '../../contexts/MaskedAttributesContext';
|
|
42
43
|
import { sendUnmaskActivity } from './helpers';
|
|
@@ -48,11 +49,12 @@ export var useMaskedAttribute = function (_a) {
|
|
|
48
49
|
var metadata = useMdmMetadata();
|
|
49
50
|
var showMasking = useMdmShowMasking();
|
|
50
51
|
var entityFromContext = useContext(EntityContext);
|
|
52
|
+
var relation = useContext(RelationContext);
|
|
51
53
|
var mainEntity = useMdmEntity();
|
|
52
54
|
var entity = entityProp || entityFromContext || mainEntity;
|
|
53
55
|
var canUnmaskAttribute = checkCanUnmaskAttribute(attributeType);
|
|
54
56
|
var isRelationAttribute = isRelationUri(attributeValue.uri);
|
|
55
|
-
var hasUnmaskDataPermissions = isRelationAttribute
|
|
57
|
+
var hasUnmaskDataPermissions = checkDataPermissionsToUnmask(isRelationAttribute ? relation : entity);
|
|
56
58
|
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;
|
|
57
59
|
var isUnmaskingNeeded = unmaskAttributeValue &&
|
|
58
60
|
maskAttributeValue &&
|
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
13
13
|
import { cond, pipe, prop, T, evolve, filter as filterFn, when, identity, times, length, ifElse, always } from 'ramda';
|
|
14
14
|
import i18n from 'ui-i18n';
|
|
15
|
-
import { ActivityFilter, addGlobalFilterToQuery, getRelationsForDataTenantEntity, getRelationsForEntity, isAvailableEntityTypeUri, isAvailableRelationTypeUri, isDataTenantEntity, getInOutRelationUri, isTempUri, Mode, wrapInArrayIfNeeded, hasRelationMasking } from '@reltio/mdm-sdk';
|
|
15
|
+
import { ActivityFilter, addGlobalFilterToQuery, getRelationsForDataTenantEntity, getRelationsForEntity, isAvailableEntityTypeUri, isAvailableRelationTypeUri, isDataTenantEntity, getInOutRelationUri, isTempUri, Mode, wrapInArrayIfNeeded, hasRelationMasking, addRelationMaskingOptions } from '@reltio/mdm-sdk';
|
|
16
16
|
import { useSafePromise } from '../useSafePromise';
|
|
17
17
|
import { usePrevious } from '../usePrevious';
|
|
18
18
|
import { useMdmAction, useMdmDtssPath, useMdmGlobalSearchRequestOptions, useMdmMetadata, useMdmProfileLastLoadedTime, useMdmShowMasking, useMdmTenant } from '../../contexts/MdmModuleContext';
|
|
@@ -51,11 +51,7 @@ export var useRelationsLoader = function (_a) {
|
|
|
51
51
|
var suggested = config.suggested;
|
|
52
52
|
var options = useMemo(function () {
|
|
53
53
|
var sendMasked = showMasking && hasRelationMasking(metadata) && mode === Mode.Viewing;
|
|
54
|
-
return {
|
|
55
|
-
searchByOv: searchByOv,
|
|
56
|
-
sendMasked: sendMasked,
|
|
57
|
-
searchRelationsWithFilter: searchRelationsWithFilter
|
|
58
|
-
};
|
|
54
|
+
return addRelationMaskingOptions({ searchByOv: searchByOv, searchRelationsWithFilter: searchRelationsWithFilter }, sendMasked);
|
|
59
55
|
}, [searchByOv, showMasking, metadata, mode, searchRelationsWithFilter]);
|
|
60
56
|
var filters = useMemo(function () {
|
|
61
57
|
var _a;
|
|
@@ -87,9 +87,8 @@ var setUp = function (_a) {
|
|
|
87
87
|
};
|
|
88
88
|
return __assign(__assign({}, renderHook(useRelationsLoader, { initialProps: props, wrapper: Providers })), { updateMdmValues: updateMdmValues });
|
|
89
89
|
};
|
|
90
|
-
var createMetadata = function (
|
|
91
|
-
|
|
92
|
-
if (relationAccess === void 0) { relationAccess = []; }
|
|
90
|
+
var createMetadata = function (_a) {
|
|
91
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.entityAccess, entityAccess = _c === void 0 ? [] : _c, _d = _b.relationAccess, relationAccess = _d === void 0 ? [] : _d, _e = _b.masking, masking = _e === void 0 ? false : _e;
|
|
93
92
|
return {
|
|
94
93
|
entityTypes: [
|
|
95
94
|
{
|
|
@@ -111,15 +110,17 @@ var createMetadata = function (entityAccess, relationAccess) {
|
|
|
111
110
|
],
|
|
112
111
|
relationTypes: [
|
|
113
112
|
{
|
|
114
|
-
uri: 'configuration/
|
|
113
|
+
uri: 'configuration/relationTypes/HCPtoHCA',
|
|
115
114
|
label: 'HCP2HCA',
|
|
116
115
|
access: ['DELETE', 'READ', 'CREATE', 'UPDATE'],
|
|
117
|
-
attributes: [
|
|
116
|
+
attributes: [
|
|
117
|
+
__assign({ uri: 'configuration/relationTypes/HCPtoHCA/attributes/AddressRank', label: 'AddressRank', type: 'String', description: 'Address rank', name: 'AddressRank' }, (masking && { masking: { regexPattern: '.*' } }))
|
|
118
|
+
],
|
|
118
119
|
abstract: false,
|
|
119
120
|
businessCardAttributeURIs: []
|
|
120
121
|
},
|
|
121
122
|
{
|
|
122
|
-
uri: 'configuration/
|
|
123
|
+
uri: 'configuration/relationTypes/HCPtoHCP',
|
|
123
124
|
label: 'HCP',
|
|
124
125
|
access: relationAccess,
|
|
125
126
|
attributes: [],
|
|
@@ -147,7 +148,7 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
147
148
|
return __generator(this, function (_b) {
|
|
148
149
|
switch (_b.label) {
|
|
149
150
|
case 0:
|
|
150
|
-
metadata = createMetadata(['DELETE', 'READ', 'CREATE', 'UPDATE']);
|
|
151
|
+
metadata = createMetadata({ entityAccess: ['DELETE', 'READ', 'CREATE', 'UPDATE'] });
|
|
151
152
|
mdmValues = __assign(__assign({}, defaultMdmValues), { metadata: metadata });
|
|
152
153
|
_a = setUp({ mdmValues: mdmValues }), result = _a.result, waitFor = _a.waitFor;
|
|
153
154
|
act(function () {
|
|
@@ -172,7 +173,7 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
172
173
|
return __generator(this, function (_b) {
|
|
173
174
|
switch (_b.label) {
|
|
174
175
|
case 0:
|
|
175
|
-
metadata = createMetadata(['DELETE', 'READ', 'CREATE', 'UPDATE']);
|
|
176
|
+
metadata = createMetadata({ entityAccess: ['DELETE', 'READ', 'CREATE', 'UPDATE'] });
|
|
176
177
|
mdmValues = __assign(__assign({}, defaultMdmValues), { metadata: metadata });
|
|
177
178
|
_a = setUp({ mdmValues: mdmValues }), result = _a.result, waitFor = _a.waitFor, updateMdmValues = _a.updateMdmValues;
|
|
178
179
|
reloadFirst = result.current.reload;
|
|
@@ -195,18 +196,18 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
195
196
|
return __generator(this, function (_b) {
|
|
196
197
|
switch (_b.label) {
|
|
197
198
|
case 0:
|
|
198
|
-
metadata = createMetadata(['DELETE', 'READ', 'CREATE', 'UPDATE']);
|
|
199
|
+
metadata = createMetadata({ entityAccess: ['DELETE', 'READ', 'CREATE', 'UPDATE'] });
|
|
199
200
|
config = {
|
|
200
201
|
id: 'id',
|
|
201
202
|
content: {
|
|
202
203
|
inRelations: [
|
|
203
|
-
{ uri: 'configuration/
|
|
204
|
-
'configuration/
|
|
204
|
+
{ uri: 'configuration/relationTypes/HCPtoHCA', label: 'HCP2HCA' },
|
|
205
|
+
'configuration/relationTypes/HCPtoHCP'
|
|
205
206
|
],
|
|
206
207
|
entityTypes: ['configuration/entityTypes/HCP', 'configuration/entityTypes/HCA'],
|
|
207
208
|
outRelations: [
|
|
208
|
-
{ uri: 'configuration/
|
|
209
|
-
'configuration/
|
|
209
|
+
{ uri: 'configuration/relationTypes/HCPtoHCP', label: 'HCP' },
|
|
210
|
+
'configuration/relationTypes/HCPtoHCA'
|
|
210
211
|
]
|
|
211
212
|
}
|
|
212
213
|
};
|
|
@@ -217,17 +218,14 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
217
218
|
{
|
|
218
219
|
activeness: { entity: 'all', relation: 'all' },
|
|
219
220
|
entityTypes: ['configuration/entityTypes/HCP', 'configuration/entityTypes/HCA'],
|
|
220
|
-
inRelations: [{ label: 'HCP2HCA', uri: 'configuration/
|
|
221
|
+
inRelations: [{ label: 'HCP2HCA', uri: 'configuration/relationTypes/HCPtoHCA' }],
|
|
221
222
|
max: 1,
|
|
222
223
|
offset: 0,
|
|
223
|
-
outRelations: ['configuration/
|
|
224
|
+
outRelations: ['configuration/relationTypes/HCPtoHCA'],
|
|
224
225
|
returnDates: true,
|
|
225
226
|
returnObjects: true
|
|
226
227
|
}
|
|
227
|
-
], {
|
|
228
|
-
searchByOv: false,
|
|
229
|
-
sendMasked: false
|
|
230
|
-
});
|
|
228
|
+
], { searchByOv: false });
|
|
231
229
|
return [4 /*yield*/, waitFor(function () { return expect(result.current.isLoading).toBe(false); })];
|
|
232
230
|
case 1:
|
|
233
231
|
_b.sent();
|
|
@@ -246,28 +244,28 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
246
244
|
content: {
|
|
247
245
|
inRelations: [
|
|
248
246
|
{
|
|
249
|
-
uri: 'configuration/
|
|
247
|
+
uri: 'configuration/relationTypes/HCPtoHCA',
|
|
250
248
|
label: 'HCP2HCA'
|
|
251
249
|
},
|
|
252
|
-
'configuration/
|
|
250
|
+
'configuration/relationTypes/HCPtoHCP'
|
|
253
251
|
],
|
|
254
252
|
entityTypes: ['configuration/entityTypes/HCP', 'configuration/entityTypes/HCA'],
|
|
255
253
|
outRelations: [
|
|
256
|
-
{ uri: 'configuration/
|
|
257
|
-
'configuration/
|
|
254
|
+
{ uri: 'configuration/relationTypes/HCPtoHCP', label: 'HCP' },
|
|
255
|
+
'configuration/relationTypes/HCPtoHCA'
|
|
258
256
|
],
|
|
259
257
|
nextEntry: {
|
|
260
258
|
inRelations: [
|
|
261
259
|
{
|
|
262
|
-
uri: 'configuration/
|
|
260
|
+
uri: 'configuration/relationTypes/HCPtoHCA',
|
|
263
261
|
label: 'HCP2HCA'
|
|
264
262
|
},
|
|
265
|
-
'configuration/
|
|
263
|
+
'configuration/relationTypes/HCPtoHCP'
|
|
266
264
|
],
|
|
267
265
|
entityTypes: ['configuration/entityTypes/HCP', 'configuration/entityTypes/HCA'],
|
|
268
266
|
outRelations: [
|
|
269
|
-
{ uri: 'configuration/
|
|
270
|
-
'configuration/
|
|
267
|
+
{ uri: 'configuration/relationTypes/HCPtoHCP', label: 'HCP' },
|
|
268
|
+
'configuration/relationTypes/HCPtoHCA'
|
|
271
269
|
]
|
|
272
270
|
}
|
|
273
271
|
}
|
|
@@ -279,10 +277,10 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
279
277
|
{
|
|
280
278
|
activeness: { entity: 'all', relation: 'all' },
|
|
281
279
|
entityTypes: ['configuration/entityTypes/HCA'],
|
|
282
|
-
inRelations: [{ label: 'HCP2HCA', uri: 'configuration/
|
|
280
|
+
inRelations: [{ label: 'HCP2HCA', uri: 'configuration/relationTypes/HCPtoHCA' }],
|
|
283
281
|
max: 1,
|
|
284
282
|
offset: 0,
|
|
285
|
-
outRelations: ['configuration/
|
|
283
|
+
outRelations: ['configuration/relationTypes/HCPtoHCA'],
|
|
286
284
|
returnDates: true,
|
|
287
285
|
returnObjects: true,
|
|
288
286
|
nextEntry: {
|
|
@@ -290,16 +288,13 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
290
288
|
inRelations: [
|
|
291
289
|
{
|
|
292
290
|
label: 'HCP2HCA',
|
|
293
|
-
uri: 'configuration/
|
|
291
|
+
uri: 'configuration/relationTypes/HCPtoHCA'
|
|
294
292
|
}
|
|
295
293
|
],
|
|
296
|
-
outRelations: ['configuration/
|
|
294
|
+
outRelations: ['configuration/relationTypes/HCPtoHCA']
|
|
297
295
|
}
|
|
298
296
|
}
|
|
299
|
-
], {
|
|
300
|
-
searchByOv: false,
|
|
301
|
-
sendMasked: false
|
|
302
|
-
});
|
|
297
|
+
], { searchByOv: false });
|
|
303
298
|
return [4 /*yield*/, waitFor(function () { return expect(result.current.isLoading).toBe(false); })];
|
|
304
299
|
case 1:
|
|
305
300
|
_b.sent();
|
|
@@ -318,28 +313,28 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
318
313
|
content: {
|
|
319
314
|
inRelations: [
|
|
320
315
|
{
|
|
321
|
-
uri: 'configuration/
|
|
316
|
+
uri: 'configuration/relationTypes/HCPtoHCA',
|
|
322
317
|
label: 'HCP2HCA'
|
|
323
318
|
},
|
|
324
|
-
'configuration/
|
|
319
|
+
'configuration/relationTypes/HCPtoHCP'
|
|
325
320
|
],
|
|
326
321
|
entityTypes: ['configuration/entityTypes/HCA'],
|
|
327
322
|
outRelations: [
|
|
328
|
-
{ uri: 'configuration/
|
|
329
|
-
'configuration/
|
|
323
|
+
{ uri: 'configuration/relationTypes/HCPtoHCP', label: 'HCP' },
|
|
324
|
+
'configuration/relationTypes/HCPtoHCA'
|
|
330
325
|
],
|
|
331
326
|
nextEntry: {
|
|
332
327
|
inRelations: [
|
|
333
328
|
{
|
|
334
|
-
uri: 'configuration/
|
|
329
|
+
uri: 'configuration/relationTypes/HCPtoHCA',
|
|
335
330
|
label: 'HCP2HCA'
|
|
336
331
|
},
|
|
337
|
-
'configuration/
|
|
332
|
+
'configuration/relationTypes/HCPtoHCP'
|
|
338
333
|
],
|
|
339
334
|
entityTypes: ['configuration/entityTypes/HCP'],
|
|
340
335
|
outRelations: [
|
|
341
|
-
{ uri: 'configuration/
|
|
342
|
-
'configuration/
|
|
336
|
+
{ uri: 'configuration/relationTypes/HCPtoHCP', label: 'HCP' },
|
|
337
|
+
'configuration/relationTypes/HCPtoHCA'
|
|
343
338
|
]
|
|
344
339
|
}
|
|
345
340
|
}
|
|
@@ -366,15 +361,15 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
366
361
|
content: {
|
|
367
362
|
inRelations: [
|
|
368
363
|
{
|
|
369
|
-
uri: 'configuration/
|
|
364
|
+
uri: 'configuration/relationTypes/HCPtoHCA',
|
|
370
365
|
label: 'HCP2HCA'
|
|
371
366
|
},
|
|
372
|
-
'configuration/
|
|
367
|
+
'configuration/relationTypes/HCPtoHCP'
|
|
373
368
|
],
|
|
374
369
|
entityTypes: ['configuration/entityTypes/HCP'],
|
|
375
370
|
outRelations: [
|
|
376
|
-
{ uri: 'configuration/
|
|
377
|
-
'configuration/
|
|
371
|
+
{ uri: 'configuration/relationTypes/HCPtoHCP', label: 'HCP' },
|
|
372
|
+
'configuration/relationTypes/HCPtoHCA'
|
|
378
373
|
]
|
|
379
374
|
}
|
|
380
375
|
};
|
|
@@ -400,14 +395,14 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
400
395
|
content: {
|
|
401
396
|
inRelations: [
|
|
402
397
|
{
|
|
403
|
-
uri: 'configuration/
|
|
398
|
+
uri: 'configuration/relationTypes/HCPtoHCA',
|
|
404
399
|
label: 'HCP2HCA'
|
|
405
400
|
},
|
|
406
|
-
'configuration/
|
|
401
|
+
'configuration/relationTypes/HCPtoHCP'
|
|
407
402
|
],
|
|
408
403
|
outRelations: [
|
|
409
|
-
{ uri: 'configuration/
|
|
410
|
-
'configuration/
|
|
404
|
+
{ uri: 'configuration/relationTypes/HCPtoHCP', label: 'HCP' },
|
|
405
|
+
'configuration/relationTypes/HCPtoHCA'
|
|
411
406
|
]
|
|
412
407
|
}
|
|
413
408
|
};
|
|
@@ -417,16 +412,48 @@ describe('useRelationsLoader behaviour', function () {
|
|
|
417
412
|
expect(getRelationsForEntity).toHaveBeenCalledWith('123', [
|
|
418
413
|
{
|
|
419
414
|
activeness: { entity: 'all', relation: 'all' },
|
|
420
|
-
inRelations: [{ label: 'HCP2HCA', uri: 'configuration/
|
|
415
|
+
inRelations: [{ label: 'HCP2HCA', uri: 'configuration/relationTypes/HCPtoHCA' }],
|
|
416
|
+
max: 1,
|
|
417
|
+
offset: 0,
|
|
418
|
+
outRelations: ['configuration/relationTypes/HCPtoHCA'],
|
|
419
|
+
returnDates: true,
|
|
420
|
+
returnObjects: true
|
|
421
|
+
}
|
|
422
|
+
], { searchByOv: false });
|
|
423
|
+
return [4 /*yield*/, waitFor(function () { return expect(result.current.isLoading).toBe(false); })];
|
|
424
|
+
case 1:
|
|
425
|
+
_b.sent();
|
|
426
|
+
return [2 /*return*/];
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
}); });
|
|
430
|
+
});
|
|
431
|
+
describe('masking behaviour', function () {
|
|
432
|
+
it('should send correct masking options if relation has masking', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
433
|
+
var metadata, mdmValues, _a, result, waitFor;
|
|
434
|
+
return __generator(this, function (_b) {
|
|
435
|
+
switch (_b.label) {
|
|
436
|
+
case 0:
|
|
437
|
+
metadata = createMetadata({ masking: true });
|
|
438
|
+
mdmValues = __assign(__assign({}, defaultMdmValues), { metadata: metadata });
|
|
439
|
+
_a = setUp({ mdmValues: mdmValues }), result = _a.result, waitFor = _a.waitFor;
|
|
440
|
+
act(function () {
|
|
441
|
+
result.current.reload();
|
|
442
|
+
});
|
|
443
|
+
expect(getRelationsForEntity).toHaveBeenCalledWith('123', [
|
|
444
|
+
{
|
|
445
|
+
activeness: { entity: 'all', relation: 'all' },
|
|
446
|
+
inRelations: [],
|
|
421
447
|
max: 1,
|
|
422
448
|
offset: 0,
|
|
423
|
-
outRelations: [
|
|
449
|
+
outRelations: [],
|
|
424
450
|
returnDates: true,
|
|
425
451
|
returnObjects: true
|
|
426
452
|
}
|
|
427
453
|
], {
|
|
428
454
|
searchByOv: false,
|
|
429
|
-
sendMasked:
|
|
455
|
+
sendMasked: true,
|
|
456
|
+
showAccess: true
|
|
430
457
|
});
|
|
431
458
|
return [4 /*yield*/, waitFor(function () { return expect(result.current.isLoading).toBe(false); })];
|
|
432
459
|
case 1:
|
|
@@ -47,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
};
|
|
48
48
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
49
49
|
import { reject } from 'ramda';
|
|
50
|
-
import { getSegments, isAbortError, isEmptyValue } from '@reltio/mdm-sdk';
|
|
50
|
+
import { getSegments, isAbortError, isEmptyValue, NewSegmentItemType } from '@reltio/mdm-sdk';
|
|
51
51
|
import { RequestStates } from '../../types';
|
|
52
52
|
import { buildSegmentsFilterString, isActiveFilter } from '../../helpers/segments';
|
|
53
53
|
import { showDefaultErrorMessage } from '../../helpers/errors';
|
|
@@ -57,8 +57,9 @@ export var useSegmentsLoader = function (_a) {
|
|
|
57
57
|
var _c = useState([]), segments = _c[0], setSegments = _c[1];
|
|
58
58
|
var _d = useState(0), total = _d[0], setTotal = _d[1];
|
|
59
59
|
var _e = sorting || {}, sort = _e.field, order = _e.order;
|
|
60
|
-
var filterString = buildSegmentsFilterString(filters);
|
|
61
60
|
var hasActiveFilter = isActiveFilter(filters !== null && filters !== void 0 ? filters : {});
|
|
61
|
+
var hasSearchValue = Boolean((filters === null || filters === void 0 ? void 0 : filters.searchValue) && filters.searchValue.length > 0);
|
|
62
|
+
var filterString = buildSegmentsFilterString(__assign(__assign({}, filters), (hasActiveFilter && !hasSearchValue ? { itemType: NewSegmentItemType.Segment } : {})));
|
|
62
63
|
var params = useMemo(function () {
|
|
63
64
|
return reject(isEmptyValue, __assign(__assign({ sort: sort, order: order, max: rowsPerPage, offset: page * rowsPerPage, filter: filterString }, (parentId && !hasActiveFilter ? { parentId: parentId } : {})), (hasActiveFilter ? { fetchAll: true } : {})));
|
|
64
65
|
}, [sort, order, rowsPerPage, page, filterString, parentId, hasActiveFilter]);
|
package/index.d.ts
CHANGED
|
@@ -214,6 +214,7 @@ export { EntityLoadingIndicationProvider, useEntityLoadingIndication } from './c
|
|
|
214
214
|
export { WorkflowTasksContext } from './contexts/WorkflowTasksContext';
|
|
215
215
|
export { RelatedObjectUrisContext } from './contexts/RelatedObjectUrisContext';
|
|
216
216
|
export { EntityContext } from './contexts/EntityContext';
|
|
217
|
+
export { RelationContext } from './contexts/RelationContext';
|
|
217
218
|
export { SandboxAPIContext } from './contexts/SandboxAPIContext';
|
|
218
219
|
export { useReloadAllFacets, ReloadFacetProvider, useReloadFacet } from './contexts/ReloadFacetContext';
|
|
219
220
|
export { SearchFiltersContext } from './contexts/SearchFiltersContext';
|
package/index.js
CHANGED
|
@@ -216,6 +216,7 @@ export { EntityLoadingIndicationProvider, useEntityLoadingIndication } from './c
|
|
|
216
216
|
export { WorkflowTasksContext } from './contexts/WorkflowTasksContext';
|
|
217
217
|
export { RelatedObjectUrisContext } from './contexts/RelatedObjectUrisContext';
|
|
218
218
|
export { EntityContext } from './contexts/EntityContext';
|
|
219
|
+
export { RelationContext } from './contexts/RelationContext';
|
|
219
220
|
export { SandboxAPIContext } from './contexts/SandboxAPIContext';
|
|
220
221
|
export { useReloadAllFacets, ReloadFacetProvider, useReloadFacet } from './contexts/ReloadFacetContext';
|
|
221
222
|
export { SearchFiltersContext } from './contexts/SearchFiltersContext';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2144",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@fluentui/react-context-selector": "^9.1.26",
|
|
12
12
|
"@googlemaps/markerclusterer": "^2.5.3",
|
|
13
13
|
"@react-sigma/core": "3.4.0",
|
|
14
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
14
|
+
"@reltio/mdm-sdk": "^1.4.1969",
|
|
15
15
|
"@vis.gl/react-google-maps": "^1.3.0",
|
|
16
16
|
"d3-cloud": "^1.2.5",
|
|
17
17
|
"d3-geo": "^2.0.1",
|