@reltio/components 1.4.895 → 1.4.899
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/attributes/PivotingAttributes/PivotingTooltipContent.js +11 -3
- package/cjs/components/attributes/PivotingAttributes/helpers.d.ts +4 -0
- package/cjs/components/attributes/PivotingAttributes/helpers.js +17 -1
- package/cjs/components/attributes/PivotingAttributes/styles.d.ts +1 -1
- package/cjs/components/attributes/PivotingAttributes/styles.js +3 -0
- package/cjs/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +6 -12
- package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +8 -0
- package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.js +47 -0
- package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +11 -0
- package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.js +27 -0
- package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/styles.d.ts +1 -0
- package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/styles.js +55 -0
- package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.d.ts +7 -0
- package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.js +25 -0
- package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.d.ts +15 -0
- package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.js +61 -0
- package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.d.ts +5 -0
- package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.js +18 -0
- package/cjs/components/workflow/components/AttributesChanges/components/ShowMoreLink/ShowMoreLink.d.ts +9 -0
- package/cjs/components/workflow/components/AttributesChanges/components/ShowMoreLink/ShowMoreLink.js +18 -0
- package/cjs/components/workflow/components/AttributesChanges/components/ShowMoreLink/styles.d.ts +1 -0
- package/cjs/components/workflow/components/AttributesChanges/components/ShowMoreLink/styles.js +12 -0
- package/cjs/components/workflow/components/AttributesChanges/constants/operations.d.ts +25 -0
- package/cjs/components/workflow/components/AttributesChanges/constants/operations.js +30 -0
- package/cjs/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +3 -0
- package/cjs/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.js +9 -0
- package/cjs/components/workflow/components/AttributesChanges/helpers/attributesHelpers.d.ts +2 -0
- package/cjs/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +89 -0
- package/cjs/components/workflow/components/AttributesChanges/helpers/contextHelpers.d.ts +1 -0
- package/cjs/components/workflow/components/AttributesChanges/helpers/contextHelpers.js +5 -0
- package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +12 -0
- package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.js +88 -0
- package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +4 -0
- package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +137 -0
- package/cjs/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.d.ts +6 -0
- package/cjs/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.js +18 -0
- package/cjs/components/workflow/components/AttributesChanges/styles.d.ts +1 -0
- package/cjs/components/workflow/components/AttributesChanges/styles.js +27 -0
- package/cjs/components/workflow/components/AttributesChanges/types/DCRTypes.d.ts +63 -0
- package/cjs/components/workflow/components/AttributesChanges/types/DCRTypes.js +2 -0
- package/cjs/components/workflow/components/LineDecorator/styles.js +4 -2
- package/esm/components/attributes/PivotingAttributes/PivotingTooltipContent.js +13 -5
- package/esm/components/attributes/PivotingAttributes/helpers.d.ts +4 -0
- package/esm/components/attributes/PivotingAttributes/helpers.js +15 -1
- package/esm/components/attributes/PivotingAttributes/styles.d.ts +1 -1
- package/esm/components/attributes/PivotingAttributes/styles.js +3 -0
- package/esm/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +7 -13
- package/esm/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +8 -0
- package/esm/components/workflow/components/AttributesChanges/AttributesChanges.js +23 -0
- package/esm/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +11 -0
- package/esm/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.js +22 -0
- package/esm/components/workflow/components/AttributesChanges/components/ChangeView/styles.d.ts +1 -0
- package/esm/components/workflow/components/AttributesChanges/components/ChangeView/styles.js +52 -0
- package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.d.ts +7 -0
- package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.js +20 -0
- package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.d.ts +15 -0
- package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.js +37 -0
- package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.d.ts +5 -0
- package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.js +15 -0
- package/esm/components/workflow/components/AttributesChanges/components/ShowMoreLink/ShowMoreLink.d.ts +9 -0
- package/esm/components/workflow/components/AttributesChanges/components/ShowMoreLink/ShowMoreLink.js +13 -0
- package/esm/components/workflow/components/AttributesChanges/components/ShowMoreLink/styles.d.ts +1 -0
- package/esm/components/workflow/components/AttributesChanges/components/ShowMoreLink/styles.js +9 -0
- package/esm/components/workflow/components/AttributesChanges/constants/operations.d.ts +25 -0
- package/esm/components/workflow/components/AttributesChanges/constants/operations.js +27 -0
- package/esm/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +3 -0
- package/esm/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.js +3 -0
- package/esm/components/workflow/components/AttributesChanges/helpers/attributesHelpers.d.ts +2 -0
- package/esm/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +86 -0
- package/esm/components/workflow/components/AttributesChanges/helpers/contextHelpers.d.ts +1 -0
- package/esm/components/workflow/components/AttributesChanges/helpers/contextHelpers.js +2 -0
- package/esm/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +12 -0
- package/esm/components/workflow/components/AttributesChanges/helpers/helpers.js +77 -0
- package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +4 -0
- package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +134 -0
- package/esm/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.d.ts +6 -0
- package/esm/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.js +14 -0
- package/esm/components/workflow/components/AttributesChanges/styles.d.ts +1 -0
- package/esm/components/workflow/components/AttributesChanges/styles.js +24 -0
- package/esm/components/workflow/components/AttributesChanges/types/DCRTypes.d.ts +63 -0
- package/esm/components/workflow/components/AttributesChanges/types/DCRTypes.js +1 -0
- package/esm/components/workflow/components/LineDecorator/styles.js +4 -2
- package/package.json +3 -3
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getChanges = void 0;
|
|
4
|
+
var ramda_1 = require("ramda");
|
|
5
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
6
|
+
var attributesView_1 = require("../../../../attributes/helpers/attributesView");
|
|
7
|
+
var helpers_1 = require("./helpers");
|
|
8
|
+
var operations_1 = require("../constants/operations");
|
|
9
|
+
var getValues = function (attributes, attrType) {
|
|
10
|
+
if ('newValue' in attributes || 'oldValue' in attributes) {
|
|
11
|
+
var newValue = attributes.newValue, oldValue = attributes.oldValue, type_1 = attributes.type;
|
|
12
|
+
var newAttrValues_1 = ramda_1.pathOr([], ['value', attrType.name])(newValue);
|
|
13
|
+
var oldAttrValues_1 = ramda_1.pathOr([], ['value', attrType.name])(oldValue);
|
|
14
|
+
var length_1 = Math.max(newAttrValues_1.length, oldAttrValues_1.length);
|
|
15
|
+
return ramda_1.times(function (index) {
|
|
16
|
+
var attributeValue = {
|
|
17
|
+
newValue: newAttrValues_1[index],
|
|
18
|
+
oldValue: oldAttrValues_1[index],
|
|
19
|
+
type: type_1
|
|
20
|
+
};
|
|
21
|
+
return [{ value: attributeValue }];
|
|
22
|
+
}, length_1);
|
|
23
|
+
}
|
|
24
|
+
var values = attributes[attrType.name];
|
|
25
|
+
return values ? [values] : [];
|
|
26
|
+
};
|
|
27
|
+
var getChanges = ramda_1.curry(function (metadata, objectInfo, changes) {
|
|
28
|
+
var attrTypes = attributesView_1.getFilteredAttrTypes(metadata, objectInfo.type, [], []);
|
|
29
|
+
return getAttributesList(metadata, attrTypes, changes);
|
|
30
|
+
});
|
|
31
|
+
exports.getChanges = getChanges;
|
|
32
|
+
var getAttributesList = function (metadata, attrTypes, attributes, level) {
|
|
33
|
+
if (level === void 0) { level = 0; }
|
|
34
|
+
return ramda_1.flatten(attrTypes
|
|
35
|
+
.map(function (attrType) {
|
|
36
|
+
return getValues(attributes, attrType).map(function (value) {
|
|
37
|
+
return value.map(function (attributeValue) {
|
|
38
|
+
return dcrAttributesFactory(metadata, attrType, attributeValue, level);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
})
|
|
42
|
+
.filter(ramda_1.complement(ramda_1.isEmpty)));
|
|
43
|
+
};
|
|
44
|
+
var dcrAttributesFactory = function (metadata, attributeType, attributeValue, level) {
|
|
45
|
+
switch (attributeType.type) {
|
|
46
|
+
case mdm_sdk_1.DataTypes.TYPE_NESTED:
|
|
47
|
+
case mdm_sdk_1.DataTypes.TYPE_IMAGE:
|
|
48
|
+
return getNestedAttributeChange(metadata, attributeType, attributeValue, level);
|
|
49
|
+
case mdm_sdk_1.DataTypes.TYPE_REFERENCE:
|
|
50
|
+
return getReferenceAttributeChange(metadata, attributeType, attributeValue, level);
|
|
51
|
+
default: {
|
|
52
|
+
var value = mdm_sdk_1.isSpecialAttribute(attributeType) ? attributeValue : attributeValue.value;
|
|
53
|
+
return getSimpleAttributeChange(attributeType, value, level);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var getNestedAttributeChange = function (metadata, attributeType, attributeValue, level) {
|
|
58
|
+
var attributeTypeList = mdm_sdk_1.getAttributeTypeSubAttributes({}, attributeType);
|
|
59
|
+
var label = mdm_sdk_1.getLabel((attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name));
|
|
60
|
+
return [
|
|
61
|
+
{ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue },
|
|
62
|
+
getAttributesList(metadata, attributeTypeList, attributeValue.value, level + 1)
|
|
63
|
+
];
|
|
64
|
+
};
|
|
65
|
+
var getReferenceAttributeChange = function (metadata, attributeType, attributeValue, level) {
|
|
66
|
+
var attributeTypeList = mdm_sdk_1.getAttributeTypeSubAttributes(metadata, attributeType);
|
|
67
|
+
var label = (attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name);
|
|
68
|
+
return [
|
|
69
|
+
{ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue },
|
|
70
|
+
getAttributesList(metadata, attributeTypeList, attributeValue.value, level + 1)
|
|
71
|
+
];
|
|
72
|
+
};
|
|
73
|
+
var getDiffParameters = function (_a) {
|
|
74
|
+
var newValue = _a.newValue, oldValue = _a.oldValue, type = _a.type;
|
|
75
|
+
return type === operations_1.DCRTypes.UPDATE_ATTRIBUTE ? { type: type, newValue: newValue, oldValue: oldValue } : { type: type, newValue: oldValue || newValue };
|
|
76
|
+
};
|
|
77
|
+
var getSimpleAttributeChange = function (attributeType, attributeValue, level) {
|
|
78
|
+
var _a = getDiffParameters(attributeValue), newValue = _a.newValue, oldValue = _a.oldValue, type = _a.type;
|
|
79
|
+
var operation = helpers_1.getOperationType(type, oldValue);
|
|
80
|
+
var label = (attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name);
|
|
81
|
+
return {
|
|
82
|
+
attributeType: attributeType,
|
|
83
|
+
newValue: newValue,
|
|
84
|
+
oldValue: oldValue,
|
|
85
|
+
operation: operation,
|
|
86
|
+
label: label,
|
|
87
|
+
level: level
|
|
88
|
+
};
|
|
89
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getSuggestionsCount: any;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AttributeType } from '@reltio/mdm-sdk';
|
|
2
|
+
import { OperationTypes } from '../constants/operations';
|
|
3
|
+
import { ChangeRequest, DCRAttributeValue, DCRObjectsInfo, Value } from '../types/DCRTypes';
|
|
4
|
+
export declare const getOperationType: (type: string, oldValue?: DCRAttributeValue) => OperationTypes;
|
|
5
|
+
export declare const getOperationLabel: (operation: OperationTypes) => string;
|
|
6
|
+
export declare const getAttributeDescription: (attrType: AttributeType, value: DCRAttributeValue, currentEntityUri: string, objectsInfo?: DCRObjectsInfo) => {
|
|
7
|
+
objectUri: any;
|
|
8
|
+
objectLabel: any;
|
|
9
|
+
entityTypeUri: any;
|
|
10
|
+
};
|
|
11
|
+
export declare const extractObjectsFromChangeRequest: ({ objectsInfo, changes }: ChangeRequest) => any;
|
|
12
|
+
export declare const getDataTypeDefinition: (attributeType: AttributeType, attributeValue: Value) => any;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getDataTypeDefinition = exports.extractObjectsFromChangeRequest = exports.getAttributeDescription = exports.getOperationLabel = exports.getOperationType = void 0;
|
|
18
|
+
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
19
|
+
var ramda_1 = require("ramda");
|
|
20
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
21
|
+
var operations_1 = require("../constants/operations");
|
|
22
|
+
var getOperationType = function (type, oldValue) {
|
|
23
|
+
switch (type) {
|
|
24
|
+
case operations_1.DCRTypes.CREATE_RELATIONSHIP:
|
|
25
|
+
case operations_1.DCRTypes.INSERT_ATTRIBUTE:
|
|
26
|
+
return operations_1.OperationTypes.ADDED;
|
|
27
|
+
case operations_1.DCRTypes.UPDATE_TAGS:
|
|
28
|
+
case operations_1.DCRTypes.UPDATE_ROLES:
|
|
29
|
+
case operations_1.DCRTypes.UPDATE_ATTRIBUTE:
|
|
30
|
+
return operations_1.OperationTypes.EDITED;
|
|
31
|
+
case operations_1.DCRTypes.DELETE_ATTRIBUTE:
|
|
32
|
+
case operations_1.DCRTypes.DELETE_RELATIONSHIP:
|
|
33
|
+
return operations_1.OperationTypes.DELETED;
|
|
34
|
+
case operations_1.DCRTypes.PIN_ATTRIBUTE:
|
|
35
|
+
return (oldValue === null || oldValue === void 0 ? void 0 : oldValue.pin) ? operations_1.OperationTypes.PIN_DELETED : operations_1.OperationTypes.PINNED;
|
|
36
|
+
case operations_1.DCRTypes.IGNORE_ATTRIBUTE:
|
|
37
|
+
return (oldValue === null || oldValue === void 0 ? void 0 : oldValue.ignored) ? operations_1.OperationTypes.IGNORE_DELETED : operations_1.OperationTypes.IGNORED;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.getOperationType = getOperationType;
|
|
41
|
+
var getOperationLabel = function (operation) {
|
|
42
|
+
var _a;
|
|
43
|
+
var labels = (_a = {},
|
|
44
|
+
_a[operations_1.OperationTypes.ADDED] = ui_i18n_1.default.text('added'),
|
|
45
|
+
_a[operations_1.OperationTypes.EDITED] = ui_i18n_1.default.text('edited'),
|
|
46
|
+
_a[operations_1.OperationTypes.DELETED] = ui_i18n_1.default.text('deleted'),
|
|
47
|
+
_a[operations_1.OperationTypes.PINNED] = ui_i18n_1.default.text('pinned'),
|
|
48
|
+
_a[operations_1.OperationTypes.PIN_DELETED] = ui_i18n_1.default.text('pin deleted'),
|
|
49
|
+
_a[operations_1.OperationTypes.IGNORED] = ui_i18n_1.default.text('ignored'),
|
|
50
|
+
_a[operations_1.OperationTypes.IGNORE_DELETED] = ui_i18n_1.default.text('ignore deleted'),
|
|
51
|
+
_a);
|
|
52
|
+
return labels[operation] || '';
|
|
53
|
+
};
|
|
54
|
+
exports.getOperationLabel = getOperationLabel;
|
|
55
|
+
var getAttributeDescription = function (attrType, value, currentEntityUri, objectsInfo) {
|
|
56
|
+
if (objectsInfo === void 0) { objectsInfo = {}; }
|
|
57
|
+
var objectLabel, objectUri, entityTypeUri;
|
|
58
|
+
var relation = objectsInfo[value.refObjectURI];
|
|
59
|
+
if (relation) {
|
|
60
|
+
objectUri = currentEntityUri === relation.startObjectUri ? relation.endObjectUri : relation.startObjectUri;
|
|
61
|
+
objectLabel =
|
|
62
|
+
currentEntityUri === relation.startObjectUri ? relation.endObjectLabel : relation.startObjectLabel;
|
|
63
|
+
}
|
|
64
|
+
else if (value.refEntity) {
|
|
65
|
+
objectUri = value.refEntity.objectURI;
|
|
66
|
+
objectLabel = objectsInfo[objectUri].label;
|
|
67
|
+
}
|
|
68
|
+
if (objectUri && objectLabel) {
|
|
69
|
+
var objectInfo = objectsInfo[objectUri];
|
|
70
|
+
entityTypeUri = objectInfo ? objectInfo.type : attrType.referencedEntityTypeURI;
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
objectUri: objectUri,
|
|
74
|
+
objectLabel: objectLabel,
|
|
75
|
+
entityTypeUri: entityTypeUri
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
exports.getAttributeDescription = getAttributeDescription;
|
|
79
|
+
var extractObjectsFromChangeRequest = function (_a) {
|
|
80
|
+
var _b = _a.objectsInfo, objectsInfo = _b === void 0 ? {} : _b, _c = _a.changes, changes = _c === void 0 ? {} : _c;
|
|
81
|
+
var getChange = function (key) { return ramda_1.prop([key], changes); };
|
|
82
|
+
return ramda_1.pipe(ramda_1.keys, ramda_1.filter(getChange), ramda_1.map(function (key) { return (__assign(__assign({}, objectsInfo[key]), { uri: key })); }))(objectsInfo);
|
|
83
|
+
};
|
|
84
|
+
exports.extractObjectsFromChangeRequest = extractObjectsFromChangeRequest;
|
|
85
|
+
var getDataTypeDefinition = function (attributeType, attributeValue) {
|
|
86
|
+
return ramda_1.when(ramda_1.allPass([ramda_1.pipe(ramda_1.prop('type'), ramda_1.equals(mdm_sdk_1.DataTypes.TYPE_STRING)), function () { return mdm_sdk_1.isUrl(attributeValue); }]), ramda_1.evolve({ type: ramda_1.always(mdm_sdk_1.DataTypes.TYPE_URL) }))(mdm_sdk_1.getAttrDataTypeDefinition(attributeType));
|
|
87
|
+
};
|
|
88
|
+
exports.getDataTypeDefinition = getDataTypeDefinition;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeChanges = void 0;
|
|
4
|
+
var ramda_1 = require("ramda");
|
|
5
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
6
|
+
var operations_1 = require("../constants/operations");
|
|
7
|
+
var attributesHelpers_1 = require("./attributesHelpers");
|
|
8
|
+
var ATTRIBUTE_DELIMITER = '/';
|
|
9
|
+
var SPECIAL_ATTRIBUTES_NAMES = [
|
|
10
|
+
'defaultProfilePicValue',
|
|
11
|
+
mdm_sdk_1.EntityAttrTypes.tags.name,
|
|
12
|
+
mdm_sdk_1.EntityAttrTypes.roles.name,
|
|
13
|
+
mdm_sdk_1.EntityAttrTypes.startDate.name,
|
|
14
|
+
mdm_sdk_1.EntityAttrTypes.endDate.name
|
|
15
|
+
];
|
|
16
|
+
var prepareStartOrEndDate = function (_a) {
|
|
17
|
+
var newValue = _a.newValue, oldValue = _a.oldValue;
|
|
18
|
+
var parseValue = function (value) { return (ramda_1.is(String) ? parseInt(value) : value); };
|
|
19
|
+
var isExistedValue = function (value) { return (value === null || value === void 0 ? void 0 : value.length) && !mdm_sdk_1.isEmptyValue(value); };
|
|
20
|
+
var isExistNewValue = isExistedValue(newValue);
|
|
21
|
+
var isExistOldValue = isExistedValue(oldValue);
|
|
22
|
+
if (isExistNewValue && isExistOldValue) {
|
|
23
|
+
return {
|
|
24
|
+
type: operations_1.DCRTypes.UPDATE_ATTRIBUTE,
|
|
25
|
+
oldValue: { value: parseValue(oldValue[0]) },
|
|
26
|
+
newValue: { value: parseValue(newValue[0]) }
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
else if (isExistNewValue) {
|
|
30
|
+
return {
|
|
31
|
+
type: operations_1.DCRTypes.INSERT_ATTRIBUTE,
|
|
32
|
+
newValue: { value: parseValue(newValue[0]) }
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
else if (isExistOldValue) {
|
|
36
|
+
return {
|
|
37
|
+
type: operations_1.DCRTypes.DELETE_ATTRIBUTE,
|
|
38
|
+
oldValue: { value: parseValue(oldValue[0]) }
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var prepareRolesOrTags = function (change, metadata) {
|
|
43
|
+
var _a = change.newValue, newValue = _a === void 0 ? [] : _a, _b = change.oldValue, oldValue = _b === void 0 ? [] : _b, type = change.type;
|
|
44
|
+
var getLabel = type === operations_1.DCRTypes.UPDATE_ROLES ? mdm_sdk_1.getRoleLabel(metadata) : ramda_1.identity;
|
|
45
|
+
var diffNewValue = ramda_1.difference(newValue, oldValue);
|
|
46
|
+
var diffOldValue = ramda_1.difference(oldValue, newValue);
|
|
47
|
+
var items = [];
|
|
48
|
+
if (diffNewValue.length) {
|
|
49
|
+
items.push({
|
|
50
|
+
type: operations_1.DCRTypes.INSERT_ATTRIBUTE,
|
|
51
|
+
newValue: { value: diffNewValue.map(getLabel).join(', ') }
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (diffOldValue.length) {
|
|
55
|
+
items.push({
|
|
56
|
+
type: operations_1.DCRTypes.DELETE_ATTRIBUTE,
|
|
57
|
+
oldValue: { value: diffOldValue.map(getLabel).join(', ') }
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return items;
|
|
61
|
+
};
|
|
62
|
+
var getPath = function (change) {
|
|
63
|
+
var type = change.type, attributePath = change.attributePath, refObjectURI = change.refObjectURI, refAttributeType = change.refAttributeType;
|
|
64
|
+
var path = type === operations_1.DCRTypes.INSERT_ATTRIBUTE ? mdm_sdk_1.generateTempUri(attributePath) : attributePath;
|
|
65
|
+
if (refObjectURI) {
|
|
66
|
+
var typePath = refAttributeType.split('/attributes/');
|
|
67
|
+
var id = refObjectURI.split(ATTRIBUTE_DELIMITER)[1];
|
|
68
|
+
return [typePath[1], id, path].join(ATTRIBUTE_DELIMITER);
|
|
69
|
+
}
|
|
70
|
+
return path;
|
|
71
|
+
};
|
|
72
|
+
var prepareAttribute = function (container, change) {
|
|
73
|
+
var _a;
|
|
74
|
+
var changePath = getPath(change);
|
|
75
|
+
var pathArray = changePath.split(ATTRIBUTE_DELIMITER);
|
|
76
|
+
var holder = container;
|
|
77
|
+
for (var i = 0; i < pathArray.length - 1; i = i + 2) {
|
|
78
|
+
var key = pathArray[i];
|
|
79
|
+
var id = pathArray[i + 1];
|
|
80
|
+
var currentValue = (holder[key] || []).find(ramda_1.propEq('id', id));
|
|
81
|
+
var newValue = pathArray.length === i + 2 ? change : {};
|
|
82
|
+
var value = currentValue ? currentValue : { id: id, value: newValue };
|
|
83
|
+
var refObjectURI = ((_a = change.refObjectURI) === null || _a === void 0 ? void 0 : _a.indexOf(id)) >= 0 && change.refObjectURI;
|
|
84
|
+
if (refObjectURI) {
|
|
85
|
+
value.refObjectURI = refObjectURI;
|
|
86
|
+
}
|
|
87
|
+
if (ramda_1.isNil(currentValue)) {
|
|
88
|
+
holder[key] = (holder[key] || []).concat(value);
|
|
89
|
+
}
|
|
90
|
+
holder = value.value;
|
|
91
|
+
}
|
|
92
|
+
return container;
|
|
93
|
+
};
|
|
94
|
+
var mergeAttributesInChange = function (metadata, objectInfo, change, container) {
|
|
95
|
+
if (container === void 0) { container = {}; }
|
|
96
|
+
var type = change.type;
|
|
97
|
+
switch (type) {
|
|
98
|
+
case operations_1.DCRTypes.UPDATE_PROFILE_PIC_BY_URL:
|
|
99
|
+
container['defaultProfilePicValue'] = [change.newValue];
|
|
100
|
+
break;
|
|
101
|
+
case operations_1.DCRTypes.UPDATE_TAGS:
|
|
102
|
+
container[mdm_sdk_1.EntityAttrTypes.tags.name] = prepareRolesOrTags(change, metadata);
|
|
103
|
+
break;
|
|
104
|
+
case operations_1.DCRTypes.UPDATE_ROLES: {
|
|
105
|
+
container[mdm_sdk_1.EntityAttrTypes.roles.name] = prepareRolesOrTags(change, metadata);
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
case operations_1.DCRTypes.UPDATE_START_DATE:
|
|
109
|
+
container[mdm_sdk_1.EntityAttrTypes.startDate.name] = [prepareStartOrEndDate(change)];
|
|
110
|
+
break;
|
|
111
|
+
case operations_1.DCRTypes.UPDATE_END_DATE:
|
|
112
|
+
container[mdm_sdk_1.EntityAttrTypes.endDate.name] = [prepareStartOrEndDate(change)];
|
|
113
|
+
break;
|
|
114
|
+
default: {
|
|
115
|
+
prepareAttribute(container, change);
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return container;
|
|
120
|
+
};
|
|
121
|
+
var mergeChanges = function (metadata, changes, objectInfo) {
|
|
122
|
+
var getAttributeChanges = function (attributeName) { return ramda_1.pipe(ramda_1.pick([attributeName]), attributesHelpers_1.getChanges(metadata, objectInfo)); };
|
|
123
|
+
var concatChanges = ramda_1.curry(function (getters, attributesTree) {
|
|
124
|
+
return ramda_1.reduce(function (acc, getter) { return ramda_1.concat(acc, getter(attributesTree)); }, [], getters);
|
|
125
|
+
});
|
|
126
|
+
var changesTree = changes.reduce(function (result, change) {
|
|
127
|
+
return mergeAttributesInChange(metadata, objectInfo, change, result);
|
|
128
|
+
}, {});
|
|
129
|
+
return concatChanges([
|
|
130
|
+
ramda_1.pipe(ramda_1.omit(SPECIAL_ATTRIBUTES_NAMES), attributesHelpers_1.getChanges(metadata, objectInfo)),
|
|
131
|
+
getAttributeChanges(mdm_sdk_1.EntityAttrTypes.roles.name),
|
|
132
|
+
getAttributeChanges(mdm_sdk_1.EntityAttrTypes.tags.name),
|
|
133
|
+
getAttributeChanges(mdm_sdk_1.EntityAttrTypes.startDate.name),
|
|
134
|
+
getAttributeChanges(mdm_sdk_1.EntityAttrTypes.endDate.name)
|
|
135
|
+
], changesTree);
|
|
136
|
+
};
|
|
137
|
+
exports.mergeChanges = mergeChanges;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCollapsibleList = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var contextHelpers_1 = require("../helpers/contextHelpers");
|
|
6
|
+
var DEFAULT_VISIBLE_ITEMS_COUNT = 3;
|
|
7
|
+
var useCollapsibleList = function (changes, limit) {
|
|
8
|
+
if (limit === void 0) { limit = DEFAULT_VISIBLE_ITEMS_COUNT; }
|
|
9
|
+
var _a = react_1.useState(false), isExpanded = _a[0], setIsExpanded = _a[1];
|
|
10
|
+
var onToggle = react_1.useCallback(function () { return setIsExpanded(function (value) { return !value; }); }, []);
|
|
11
|
+
var collapsedItems = react_1.useMemo(function () { return changes.slice(0, limit); }, [changes, limit]);
|
|
12
|
+
var suggestionsCount = react_1.useMemo(function () { return contextHelpers_1.getSuggestionsCount(changes); }, [changes]);
|
|
13
|
+
var visibleSuggestionsCount = react_1.useMemo(function () { return contextHelpers_1.getSuggestionsCount(collapsedItems); }, [collapsedItems]);
|
|
14
|
+
var itemsToShow = isExpanded ? changes : collapsedItems;
|
|
15
|
+
var collapsedSuggestionsCount = suggestionsCount - visibleSuggestionsCount;
|
|
16
|
+
return { isExpanded: isExpanded, onToggle: onToggle, itemsToShow: itemsToShow, collapsedSuggestionsCount: collapsedSuggestionsCount };
|
|
17
|
+
};
|
|
18
|
+
exports.useCollapsibleList = useCollapsibleList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"uri" | "label" | "container" | "showMoreLink">;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
var styles_1 = require("@material-ui/core/styles");
|
|
5
|
+
exports.useStyles = styles_1.makeStyles(function (theme) { return ({
|
|
6
|
+
container: {
|
|
7
|
+
boxSizing: 'border-box',
|
|
8
|
+
border: '1px solid rgba(0,0,0,0.03)',
|
|
9
|
+
borderRadius: '3px',
|
|
10
|
+
backgroundColor: 'rgba(0,0,0,0.03)',
|
|
11
|
+
padding: '10px',
|
|
12
|
+
margin: '12px 16px 12px 0'
|
|
13
|
+
},
|
|
14
|
+
uri: {
|
|
15
|
+
color: theme.palette.primary.main,
|
|
16
|
+
textDecoration: 'none',
|
|
17
|
+
cursor: 'pointer'
|
|
18
|
+
},
|
|
19
|
+
label: {
|
|
20
|
+
fontSize: '12px',
|
|
21
|
+
letterSpacing: 0,
|
|
22
|
+
lineHeight: '16px'
|
|
23
|
+
},
|
|
24
|
+
showMoreLink: {
|
|
25
|
+
marginTop: '8px'
|
|
26
|
+
}
|
|
27
|
+
}); });
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Crosswalk, NestedAttributeValue, ReferenceAttributeValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
2
|
+
import { DCRTypes } from '../constants/operations';
|
|
3
|
+
export declare type EntityInfo = {
|
|
4
|
+
isExist: boolean;
|
|
5
|
+
label: string;
|
|
6
|
+
secondaryLabel: string;
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
9
|
+
export declare type RelationInfo = {
|
|
10
|
+
type: string;
|
|
11
|
+
startObjectLabel: string;
|
|
12
|
+
startObjectUri: string;
|
|
13
|
+
endObjectLabel: string;
|
|
14
|
+
endObjectUri: string;
|
|
15
|
+
isExist: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare type DCRObjectInfo = EntityInfo | RelationInfo;
|
|
18
|
+
export declare type DCRObjectsInfo = {
|
|
19
|
+
[key: string]: DCRObjectInfo;
|
|
20
|
+
};
|
|
21
|
+
export declare type Value = DCRAttributes | DCRChange | string | boolean | number;
|
|
22
|
+
export declare type DCRAttributeValue = Omit<SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue, 'uri' | 'value'> & {
|
|
23
|
+
value: Value;
|
|
24
|
+
refObjectURI?: string;
|
|
25
|
+
refEntity?: {
|
|
26
|
+
objectURI: string;
|
|
27
|
+
};
|
|
28
|
+
uri?: string;
|
|
29
|
+
};
|
|
30
|
+
export declare type DCRAttributes = {
|
|
31
|
+
[attributeName: string]: DCRAttributeValue[];
|
|
32
|
+
};
|
|
33
|
+
export declare type ChangeValue = DCRAttributeValue | string[];
|
|
34
|
+
export declare type DCRChange = {
|
|
35
|
+
attributePath?: string;
|
|
36
|
+
attributeType?: string;
|
|
37
|
+
conflict?: string;
|
|
38
|
+
conflictDetails?: string;
|
|
39
|
+
createdBy?: string;
|
|
40
|
+
createdTime?: string;
|
|
41
|
+
crosswalk?: Crosswalk;
|
|
42
|
+
id?: string;
|
|
43
|
+
newPinOrIgnoreValue?: boolean;
|
|
44
|
+
newValue?: ChangeValue;
|
|
45
|
+
oldValue?: ChangeValue;
|
|
46
|
+
type?: DCRTypes;
|
|
47
|
+
refAttributeType?: string;
|
|
48
|
+
refObjectURI?: string;
|
|
49
|
+
};
|
|
50
|
+
export declare type DCRChanges = {
|
|
51
|
+
[key: string]: DCRChange[];
|
|
52
|
+
};
|
|
53
|
+
export declare type ChangeRequest = {
|
|
54
|
+
changes: DCRChanges;
|
|
55
|
+
createdBy: string;
|
|
56
|
+
createdTime: number;
|
|
57
|
+
objectsInfo: DCRObjectsInfo;
|
|
58
|
+
state: string;
|
|
59
|
+
type: string;
|
|
60
|
+
updatedBy: string;
|
|
61
|
+
updatedTime: number;
|
|
62
|
+
uri: string;
|
|
63
|
+
};
|
|
@@ -14,7 +14,8 @@ exports.useStyles = styles_1.makeStyles({
|
|
|
14
14
|
alignItems: 'stretch'
|
|
15
15
|
},
|
|
16
16
|
lineBlock: {
|
|
17
|
-
width: blockWidth + "px"
|
|
17
|
+
width: blockWidth + "px",
|
|
18
|
+
flexShrink: 0
|
|
18
19
|
},
|
|
19
20
|
withLinePadding: {
|
|
20
21
|
'& $noLine': {
|
|
@@ -55,7 +56,8 @@ exports.useStyles = styles_1.makeStyles({
|
|
|
55
56
|
}
|
|
56
57
|
},
|
|
57
58
|
content: {
|
|
58
|
-
flex: 1
|
|
59
|
+
flex: 1,
|
|
60
|
+
minWidth: 0
|
|
59
61
|
},
|
|
60
62
|
plain: {},
|
|
61
63
|
last: {}
|
|
@@ -10,14 +10,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import React, { useEffect, useState } from 'react';
|
|
13
|
-
import { useSelector } from 'react-redux';
|
|
13
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
14
14
|
import i18n from 'ui-i18n';
|
|
15
|
-
import mdm from '@reltio/mdm-module';
|
|
15
|
+
import mdm, { ui as mdmModuleUi } from '@reltio/mdm-module';
|
|
16
16
|
import { getEntityUriForLink, getFilteredEntities, getLabel, getTotals } from '@reltio/mdm-sdk';
|
|
17
17
|
import EntityAvatar from '../../EntityAvatar/EntityAvatar';
|
|
18
18
|
import EntityUriLink from '../../EntityUriLink/EntityUriLink';
|
|
19
19
|
import { useStyles } from './styles';
|
|
20
|
-
import { getParamsFilteringEntities } from './helpers';
|
|
20
|
+
import { convertNestedAttributePivotingValue, convertSimpleAttributePivotingValue, getParamsFilteringEntities } from './helpers';
|
|
21
21
|
import { useSafePromise } from '../../../hooks';
|
|
22
22
|
var MAX_ENTITIES_PIVOTING_TOOLTIP = 6;
|
|
23
23
|
export var PivotingTooltipContent = function (_a) {
|
|
@@ -26,9 +26,11 @@ export var PivotingTooltipContent = function (_a) {
|
|
|
26
26
|
var _d = useState(0), total = _d[0], setTotal = _d[1];
|
|
27
27
|
var entity = useSelector(mdm.selectors.getEntity) || {};
|
|
28
28
|
var safePromise = useSafePromise();
|
|
29
|
+
var dispatch = useDispatch();
|
|
29
30
|
var styles = useStyles();
|
|
30
31
|
var globalSearchRequestOptions = useSelector(mdm.selectors.getGlobalSearchRequestOptions) || {};
|
|
31
32
|
var entityType = config.entityType || entity.type;
|
|
33
|
+
var shouldShowSeeAllButton = total > MAX_ENTITIES_PIVOTING_TOOLTIP;
|
|
32
34
|
useEffect(function () {
|
|
33
35
|
var filters = getParamsFilteringEntities(value, attributeType, entityType);
|
|
34
36
|
var options = __assign({ max: MAX_ENTITIES_PIVOTING_TOOLTIP }, globalSearchRequestOptions);
|
|
@@ -43,6 +45,12 @@ export var PivotingTooltipContent = function (_a) {
|
|
|
43
45
|
setTotal(0);
|
|
44
46
|
});
|
|
45
47
|
}, []);
|
|
48
|
+
var handleClickSeeAll = function () {
|
|
49
|
+
var generatedValue = Array.isArray(value)
|
|
50
|
+
? convertNestedAttributePivotingValue(value)
|
|
51
|
+
: convertSimpleAttributePivotingValue(attributeType, value);
|
|
52
|
+
dispatch(mdmModuleUi.actions.openPivotingPerspective({ value: generatedValue, attributeType: attributeType }));
|
|
53
|
+
};
|
|
46
54
|
var hasEntityTypeLabel = Boolean(config.label);
|
|
47
55
|
return (React.createElement("div", { className: styles.container },
|
|
48
56
|
React.createElement("div", { className: styles.header },
|
|
@@ -53,6 +61,6 @@ export var PivotingTooltipContent = function (_a) {
|
|
|
53
61
|
React.createElement("div", { className: styles.body }, entities.map(function (visibleEntity) { return (React.createElement("div", { key: visibleEntity.uri, className: styles.entityContainer },
|
|
54
62
|
React.createElement(EntityAvatar, { entity: visibleEntity, avatarClassName: styles.profileIcon }),
|
|
55
63
|
React.createElement(EntityUriLink, { className: styles.entityLabel, value: getEntityUriForLink(visibleEntity) }, getLabel(visibleEntity.label)))); })),
|
|
56
|
-
React.createElement("div", { className: styles.footer },
|
|
57
|
-
React.createElement("a",
|
|
64
|
+
shouldShowSeeAllButton && (React.createElement("div", { className: styles.footer },
|
|
65
|
+
React.createElement("a", { className: styles.seeAllButton, onClick: handleClickSeeAll }, i18n.text('See all'))))));
|
|
58
66
|
};
|
|
@@ -4,4 +4,8 @@ export declare type PivotingValue = {
|
|
|
4
4
|
};
|
|
5
5
|
export declare const getParamsFilteringEntities: (values: string | number | boolean | PivotingValue[], attributeType: AttributeType, entityType?: string) => SearchFilter[];
|
|
6
6
|
export declare const generatePivotingValue: (attributeType: AttributeType, value: RecordAttributesType, pivotingAttributes: PivotingAttribute[], metadata: Metadata) => PivotingValue[];
|
|
7
|
+
export declare const convertSimpleAttributePivotingValue: (attrType: AttributeType, value: string | number | boolean) => {
|
|
8
|
+
[x: string]: string | number | boolean;
|
|
9
|
+
}[];
|
|
10
|
+
export declare const convertNestedAttributePivotingValue: (values: PivotingValue[]) => any[];
|
|
7
11
|
export declare const preparePivotingAttributeValue: (value: any, attributeType: any) => any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { attributeUriToSearchUri, DataTypes, findAttributeTypeByUri, getAttributeSource, isOv, FilterOptions } from '@reltio/mdm-sdk';
|
|
1
|
+
import { attributeUriToSearchUri, DataTypes, findAttributeTypeByUri, getAttributeSource, isOv, FilterOptions, getLastUriPart } from '@reltio/mdm-sdk';
|
|
2
2
|
import { isNil } from 'ramda';
|
|
3
3
|
export var getParamsFilteringEntities = function (values, attributeType, entityType) {
|
|
4
4
|
if (entityType === void 0) { entityType = ''; }
|
|
@@ -77,6 +77,20 @@ export var generatePivotingValue = function (attributeType, value, pivotingAttri
|
|
|
77
77
|
return acc;
|
|
78
78
|
}, []);
|
|
79
79
|
};
|
|
80
|
+
export var convertSimpleAttributePivotingValue = function (attrType, value) {
|
|
81
|
+
var _a;
|
|
82
|
+
return [
|
|
83
|
+
(_a = {}, _a[attrType.name] = value, _a)
|
|
84
|
+
];
|
|
85
|
+
};
|
|
86
|
+
export var convertNestedAttributePivotingValue = function (values) {
|
|
87
|
+
return values.map(function (value) {
|
|
88
|
+
return Object.fromEntries(Object.entries(value).map(function (_a) {
|
|
89
|
+
var key = _a[0], value = _a[1];
|
|
90
|
+
return [getLastUriPart(key), value];
|
|
91
|
+
}));
|
|
92
|
+
});
|
|
93
|
+
};
|
|
80
94
|
var valueToString = function (values, metadata, pivotingAttributes) {
|
|
81
95
|
if (!values || values.length === 0)
|
|
82
96
|
return;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"content" | "body" | "entityTypeLabel" | "title" | "icon" | "footer" | "header" | "entityLabel" | "container" | "divider" | "headerCount" | "profileIcon" | "entityContainer">;
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"content" | "body" | "entityTypeLabel" | "title" | "icon" | "footer" | "header" | "entityLabel" | "container" | "divider" | "headerCount" | "profileIcon" | "entityContainer" | "seeAllButton">;
|
|
2
2
|
export declare const usePivotingTooltipStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"tooltip" | "arrow">;
|
package/esm/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
1
|
+
import React, { useState, useEffect, useMemo } from 'react';
|
|
2
2
|
import { getDataChangeRequest } from '@reltio/mdm-sdk';
|
|
3
3
|
import GenericWorkflowTaskCard from '../GenericWorkflowTaskCard/GenericWorkflowTaskCard';
|
|
4
4
|
import LineDecorator from '../../components/LineDecorator/LineDecorator';
|
|
5
5
|
import { getDCRUri } from '../../helpers';
|
|
6
6
|
import DcrTaskIcon from '../../../../icons/DcrTaskIcon';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return (React.createElement("span", null,
|
|
11
|
-
"AttributesChanges",
|
|
12
|
-
React.createElement("br", null),
|
|
13
|
-
"AttributesChanges",
|
|
14
|
-
React.createElement("br", null),
|
|
15
|
-
"AttributesChanges"));
|
|
16
|
-
};
|
|
7
|
+
import { AttributesChangesContext } from '../../components/AttributesChanges/contexts/AttributesChangesContext';
|
|
8
|
+
import { extractObjectsFromChangeRequest } from '../../components/AttributesChanges/helpers/helpers';
|
|
9
|
+
import AttributesChanges from '../../components/AttributesChanges/AttributesChanges';
|
|
17
10
|
var DataChangeRequestTaskCard = function (_a) {
|
|
18
11
|
var task = _a.task;
|
|
19
12
|
var objectURIs = task.objectURIs;
|
|
@@ -22,7 +15,8 @@ var DataChangeRequestTaskCard = function (_a) {
|
|
|
22
15
|
useEffect(function () {
|
|
23
16
|
getDataChangeRequest(dcrUri).then(setDcr);
|
|
24
17
|
}, [dcrUri]);
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
var objectsWithChanges = useMemo(function () { return (dcr ? extractObjectsFromChangeRequest(dcr) : []); }, [dcr]);
|
|
19
|
+
return (React.createElement(GenericWorkflowTaskCard, { task: task, Icon: DcrTaskIcon }, dcr && (React.createElement(AttributesChangesContext.Provider, { value: dcr.objectsInfo },
|
|
20
|
+
React.createElement(LineDecorator, { last: true }, objectsWithChanges.map(function (object) { return (React.createElement(AttributesChanges, { key: object.uri, changes: dcr.changes[object.uri], objectInfo: object })); }))))));
|
|
27
21
|
};
|
|
28
22
|
export default DataChangeRequestTaskCard;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DCRChange, EntityInfo } from './types/DCRTypes';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
changes: DCRChange[];
|
|
5
|
+
objectInfo: EntityInfo;
|
|
6
|
+
};
|
|
7
|
+
declare const AttributesChanges: ({ changes, objectInfo }: Props) => JSX.Element;
|
|
8
|
+
export default AttributesChanges;
|