@reltio/components 1.4.2201 → 1.4.2202
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/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +36 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.d.ts +1 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +15 -6
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditor.d.ts +4 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditor.js +2 -28
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditorFactory.d.ts +4 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditorFactory.js +11 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +2 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +5 -5
- package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.d.ts +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +2 -28
- package/cjs/features/workflow/ChangeRequestEditor/context/index.d.ts +20 -0
- package/cjs/features/workflow/ChangeRequestEditor/context/index.js +76 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helper.test.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helper.test.js +237 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +4 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.js +105 -0
- package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +3 -1
- package/cjs/features/workflow/helpers/attributes.js +14 -3
- package/cjs/features/workflow/helpers/attributes.test.js +29 -7
- package/cjs/features/workflow/helpers/merge.d.ts +3 -2
- package/cjs/features/workflow/helpers/merge.js +62 -18
- package/cjs/features/workflow/helpers/merge.test.js +56 -2
- package/cjs/features/workflow/hooks/useChangesList.d.ts +2 -2
- package/cjs/features/workflow/types.d.ts +4 -3
- package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +13 -3
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.d.ts +1 -3
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +15 -6
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditor.d.ts +4 -3
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditor.js +2 -5
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditorFactory.d.ts +4 -3
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditorFactory.js +13 -5
- package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +2 -3
- package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +6 -6
- package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.d.ts +2 -2
- package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +2 -5
- package/features/workflow/ChangeRequestEditor/context/index.d.ts +20 -0
- package/features/workflow/ChangeRequestEditor/context/index.js +49 -0
- package/features/workflow/ChangeRequestEditor/helpers/helper.test.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/helpers/helper.test.js +235 -0
- package/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +4 -0
- package/features/workflow/ChangeRequestEditor/helpers/helpers.js +100 -0
- package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +3 -1
- package/features/workflow/helpers/attributes.js +14 -3
- package/features/workflow/helpers/attributes.test.js +29 -7
- package/features/workflow/helpers/merge.d.ts +3 -2
- package/features/workflow/helpers/merge.js +60 -17
- package/features/workflow/helpers/merge.test.js +56 -2
- package/features/workflow/hooks/useChangesList.d.ts +2 -2
- package/features/workflow/types.d.ts +4 -3
- package/package.json +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/helpers.d.ts +0 -3
- package/cjs/features/workflow/ChangeRequestEditor/helpers.js +0 -16
- package/features/workflow/ChangeRequestEditor/helpers.d.ts +0 -3
- package/features/workflow/ChangeRequestEditor/helpers.js +0 -12
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
4
|
+
var helpers_1 = require("./helpers");
|
|
5
|
+
describe('addLineIdToValue', function () {
|
|
6
|
+
it('should add lineIds for a simple attribute', function () {
|
|
7
|
+
var changes = {
|
|
8
|
+
'entities/0FaSodQ': [
|
|
9
|
+
{
|
|
10
|
+
id: '4pomtm9',
|
|
11
|
+
type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
|
|
12
|
+
newValue: { value: '434' }
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
};
|
|
16
|
+
var result = (0, helpers_1.addLineIdToValue)(changes);
|
|
17
|
+
expect(result).toEqual({
|
|
18
|
+
'entities/0FaSodQ': [
|
|
19
|
+
{
|
|
20
|
+
id: '4pomtm9',
|
|
21
|
+
type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
|
|
22
|
+
newValue: {
|
|
23
|
+
value: '434',
|
|
24
|
+
lineIds: ['0FaSodQ/4pomtm9/newValue']
|
|
25
|
+
},
|
|
26
|
+
lineIds: ['0FaSodQ/4pomtm9']
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
it('should add lineIds to the newValue of a UPDATE_TAGS change', function () {
|
|
32
|
+
var changes = {
|
|
33
|
+
'entities/0FaSodQ': [
|
|
34
|
+
{
|
|
35
|
+
id: '0OSJEYr',
|
|
36
|
+
type: mdm_sdk_1.DCRTypes.UPDATE_TAGS,
|
|
37
|
+
newValue: ['www', 'qqq', 'sss'],
|
|
38
|
+
oldValue: ['aaa', 'bbb', 'ccc']
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
};
|
|
42
|
+
var result = (0, helpers_1.addLineIdToValue)(changes);
|
|
43
|
+
expect(result).toEqual({
|
|
44
|
+
'entities/0FaSodQ': [
|
|
45
|
+
{
|
|
46
|
+
id: '0OSJEYr',
|
|
47
|
+
type: mdm_sdk_1.DCRTypes.UPDATE_TAGS,
|
|
48
|
+
newValue: {
|
|
49
|
+
value: ['www', 'qqq', 'sss'],
|
|
50
|
+
lineIds: ['0FaSodQ/0OSJEYr/newValue']
|
|
51
|
+
},
|
|
52
|
+
oldValue: {
|
|
53
|
+
value: ['aaa', 'bbb', 'ccc'],
|
|
54
|
+
lineIds: ['0FaSodQ/0OSJEYr/oldValue']
|
|
55
|
+
},
|
|
56
|
+
lineIds: ['0FaSodQ/0OSJEYr']
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
it('should recursively add lineIds to nested attribute values', function () {
|
|
62
|
+
var changes = {
|
|
63
|
+
'entities/0FaSodQ': [
|
|
64
|
+
{
|
|
65
|
+
id: '4ponaOj',
|
|
66
|
+
type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
|
|
67
|
+
newValue: {
|
|
68
|
+
value: {
|
|
69
|
+
TextField: [{ value: 'Test' }],
|
|
70
|
+
Int: [{ value: '42' }]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
};
|
|
76
|
+
var result = (0, helpers_1.addLineIdToValue)(changes);
|
|
77
|
+
expect(result).toEqual({
|
|
78
|
+
'entities/0FaSodQ': [
|
|
79
|
+
{
|
|
80
|
+
id: '4ponaOj',
|
|
81
|
+
type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
|
|
82
|
+
newValue: {
|
|
83
|
+
value: {
|
|
84
|
+
TextField: [
|
|
85
|
+
{
|
|
86
|
+
value: 'Test',
|
|
87
|
+
lineIds: ['0FaSodQ/4ponaOj/newValue/value/TextField/0']
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
Int: [
|
|
91
|
+
{
|
|
92
|
+
value: '42',
|
|
93
|
+
lineIds: ['0FaSodQ/4ponaOj/newValue/value/Int/0']
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
lineIds: ['0FaSodQ/4ponaOj/newValue']
|
|
98
|
+
},
|
|
99
|
+
lineIds: ['0FaSodQ/4ponaOj']
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
it('should add lineIds to all attributes of CREATE_ENTITY changes', function () {
|
|
105
|
+
var changes = {
|
|
106
|
+
'entities/1PMfzz2w': [
|
|
107
|
+
{
|
|
108
|
+
id: '36a3GSVm',
|
|
109
|
+
type: mdm_sdk_1.DCRTypes.CREATE_ENTITY,
|
|
110
|
+
objectType: 'configuration/entityTypes/Location',
|
|
111
|
+
newValue: {
|
|
112
|
+
attributes: {
|
|
113
|
+
AddressLine1: [{ value: 'www' }],
|
|
114
|
+
CityTierName: [{ value: 'ALBY' }]
|
|
115
|
+
},
|
|
116
|
+
type: 'configuration/entityTypes/Location',
|
|
117
|
+
uri: 'entities/0T5H79G'
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
};
|
|
122
|
+
var result = (0, helpers_1.addLineIdToValue)(changes);
|
|
123
|
+
expect(result).toEqual({
|
|
124
|
+
'entities/1PMfzz2w': [
|
|
125
|
+
{
|
|
126
|
+
id: '36a3GSVm',
|
|
127
|
+
type: mdm_sdk_1.DCRTypes.CREATE_ENTITY,
|
|
128
|
+
objectType: 'configuration/entityTypes/Location',
|
|
129
|
+
newValue: {
|
|
130
|
+
attributes: {
|
|
131
|
+
AddressLine1: [
|
|
132
|
+
{
|
|
133
|
+
value: 'www',
|
|
134
|
+
lineIds: ['1PMfzz2w/36a3GSVm/newValue/attributes/AddressLine1/0']
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
CityTierName: [
|
|
138
|
+
{
|
|
139
|
+
value: 'ALBY',
|
|
140
|
+
lineIds: ['1PMfzz2w/36a3GSVm/newValue/attributes/CityTierName/0']
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
type: 'configuration/entityTypes/Location',
|
|
145
|
+
uri: 'entities/0T5H79G',
|
|
146
|
+
lineIds: ['1PMfzz2w/36a3GSVm/newValue']
|
|
147
|
+
},
|
|
148
|
+
lineIds: ['1PMfzz2w/36a3GSVm']
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
it('should add lineIds to all attributes of CREATE_RELATIONSHIP changes', function () {
|
|
154
|
+
var changes = {
|
|
155
|
+
'relations/0lVSmtX': [
|
|
156
|
+
{
|
|
157
|
+
id: '0G7u0JP',
|
|
158
|
+
type: mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP,
|
|
159
|
+
newValue: {
|
|
160
|
+
attributes: {
|
|
161
|
+
PrefOrActive: [{ value: 'yfhgvm' }],
|
|
162
|
+
AffiliationStatus: [{ value: 'Status 1' }],
|
|
163
|
+
PrimaryAffiliationIndicator: [{ value: 'true' }]
|
|
164
|
+
},
|
|
165
|
+
type: 'configuration/relationTypes/DirPharmacy',
|
|
166
|
+
uri: 'relations/0Mj0zAI'
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
};
|
|
171
|
+
var result = (0, helpers_1.addLineIdToValue)(changes);
|
|
172
|
+
expect(result).toEqual({
|
|
173
|
+
'relations/0lVSmtX': [
|
|
174
|
+
{
|
|
175
|
+
id: '0G7u0JP',
|
|
176
|
+
type: mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP,
|
|
177
|
+
newValue: {
|
|
178
|
+
attributes: {
|
|
179
|
+
PrefOrActive: [
|
|
180
|
+
{
|
|
181
|
+
value: 'yfhgvm',
|
|
182
|
+
lineIds: ['0lVSmtX/0G7u0JP/newValue/attributes/PrefOrActive/0']
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
AffiliationStatus: [
|
|
186
|
+
{
|
|
187
|
+
value: 'Status 1',
|
|
188
|
+
lineIds: ['0lVSmtX/0G7u0JP/newValue/attributes/AffiliationStatus/0']
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
PrimaryAffiliationIndicator: [
|
|
192
|
+
{
|
|
193
|
+
value: 'true',
|
|
194
|
+
lineIds: ['0lVSmtX/0G7u0JP/newValue/attributes/PrimaryAffiliationIndicator/0']
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
type: 'configuration/relationTypes/DirPharmacy',
|
|
199
|
+
uri: 'relations/0Mj0zAI',
|
|
200
|
+
lineIds: ['0lVSmtX/0G7u0JP/newValue']
|
|
201
|
+
},
|
|
202
|
+
lineIds: ['0lVSmtX/0G7u0JP']
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
it('should add lineIds to both oldValue and newValue for UPDATE_ATTRIBUTE changes', function () {
|
|
208
|
+
var changes = {
|
|
209
|
+
'entities/0FaSodQ': [
|
|
210
|
+
{
|
|
211
|
+
id: '4pomtm9',
|
|
212
|
+
type: mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE,
|
|
213
|
+
oldValue: { value: 'old' },
|
|
214
|
+
newValue: { value: 'new' }
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
};
|
|
218
|
+
var result = (0, helpers_1.addLineIdToValue)(changes);
|
|
219
|
+
expect(result).toEqual({
|
|
220
|
+
'entities/0FaSodQ': [
|
|
221
|
+
{
|
|
222
|
+
id: '4pomtm9',
|
|
223
|
+
type: mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE,
|
|
224
|
+
oldValue: {
|
|
225
|
+
value: 'old',
|
|
226
|
+
lineIds: ['0FaSodQ/4pomtm9/oldValue']
|
|
227
|
+
},
|
|
228
|
+
newValue: {
|
|
229
|
+
value: 'new',
|
|
230
|
+
lineIds: ['0FaSodQ/4pomtm9/newValue']
|
|
231
|
+
},
|
|
232
|
+
lineIds: ['0FaSodQ/4pomtm9']
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DCRChanges, GroupedObjectsInfo, EnrichedDCRChanges } from '@reltio/mdm-sdk';
|
|
2
|
+
import { Diff } from '../../types';
|
|
3
|
+
export declare const isEditableChange: (change: Diff, entityInfo: GroupedObjectsInfo["entity"]) => boolean;
|
|
4
|
+
export declare const addLineIdToValue: (data: DCRChanges) => EnrichedDCRChanges;
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.addLineIdToValue = exports.isEditableChange = void 0;
|
|
15
|
+
var ramda_1 = require("ramda");
|
|
16
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
17
|
+
var isEditableChange = function (change, entityInfo) {
|
|
18
|
+
var _a;
|
|
19
|
+
var currentAttributeTypeUri = (_a = change.attributeType) === null || _a === void 0 ? void 0 : _a.uri;
|
|
20
|
+
var isExistingReferenceEntityChange = entityInfo.isExist &&
|
|
21
|
+
currentAttributeTypeUri &&
|
|
22
|
+
change.isReferenceSubAttribute &&
|
|
23
|
+
change.operation === mdm_sdk_1.DCROperationTypes.ADDED &&
|
|
24
|
+
!(0, mdm_sdk_1.isRelationTypeUri)(currentAttributeTypeUri);
|
|
25
|
+
return !!currentAttributeTypeUri && !isExistingReferenceEntityChange && !(0, ramda_1.isNil)(change.newValue);
|
|
26
|
+
};
|
|
27
|
+
exports.isEditableChange = isEditableChange;
|
|
28
|
+
var isPrimitiveValue = function (value) {
|
|
29
|
+
return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean';
|
|
30
|
+
};
|
|
31
|
+
var addLineIdRecursively = function (value, basePath) {
|
|
32
|
+
if (value == null)
|
|
33
|
+
return value;
|
|
34
|
+
if (Array.isArray(value)) {
|
|
35
|
+
return value.map(function (entry, index) {
|
|
36
|
+
if (entry && typeof entry === 'object') {
|
|
37
|
+
var entryPath = "".concat(basePath, "/").concat(index);
|
|
38
|
+
var newEntry = (0, ramda_1.clone)(entry);
|
|
39
|
+
newEntry.lineIds = [entryPath];
|
|
40
|
+
var v = newEntry.value;
|
|
41
|
+
if (typeof v === 'object' && v !== null) {
|
|
42
|
+
newEntry.value = addLineIdRecursively(v, "".concat(entryPath, "/value"));
|
|
43
|
+
}
|
|
44
|
+
return newEntry;
|
|
45
|
+
}
|
|
46
|
+
return entry;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (typeof value === 'object') {
|
|
50
|
+
var result = {};
|
|
51
|
+
for (var _i = 0, _a = Object.entries(value); _i < _a.length; _i++) {
|
|
52
|
+
var _b = _a[_i], key = _b[0], val = _b[1];
|
|
53
|
+
var childPath = "".concat(basePath, "/").concat(key);
|
|
54
|
+
result[key] = addLineIdRecursively(val, childPath);
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
return value;
|
|
59
|
+
};
|
|
60
|
+
var addLineIdToChangeValue = function (container, basePath, type) {
|
|
61
|
+
if (container == null)
|
|
62
|
+
return container;
|
|
63
|
+
if ([mdm_sdk_1.DCRTypes.CREATE_ENTITY, mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP].includes(type)) {
|
|
64
|
+
var attributes = void 0;
|
|
65
|
+
if ('attributes' in container && typeof container.attributes === 'object') {
|
|
66
|
+
attributes = addLineIdRecursively(container.attributes, "".concat(basePath, "/attributes"));
|
|
67
|
+
}
|
|
68
|
+
return __assign(__assign({}, container), { attributes: attributes, lineIds: [basePath] });
|
|
69
|
+
}
|
|
70
|
+
if (Array.isArray(container)) {
|
|
71
|
+
return { value: container, lineIds: [basePath] };
|
|
72
|
+
}
|
|
73
|
+
if (typeof container === 'object' && 'value' in container) {
|
|
74
|
+
var containerValue = container.value;
|
|
75
|
+
return __assign(__assign({}, container), { lineIds: [basePath], value: isPrimitiveValue(containerValue)
|
|
76
|
+
? containerValue
|
|
77
|
+
: addLineIdRecursively(containerValue, "".concat(basePath, "/value")) });
|
|
78
|
+
}
|
|
79
|
+
return container;
|
|
80
|
+
};
|
|
81
|
+
var addLineIdToValue = function (data) {
|
|
82
|
+
var enrichedData = (0, ramda_1.clone)(data);
|
|
83
|
+
for (var entityOrRelationKey in enrichedData) {
|
|
84
|
+
var entityOrRelationId = entityOrRelationKey.split('/')[1];
|
|
85
|
+
var changeList = enrichedData[entityOrRelationKey];
|
|
86
|
+
if (!Array.isArray(changeList))
|
|
87
|
+
continue;
|
|
88
|
+
for (var _i = 0, changeList_1 = changeList; _i < changeList_1.length; _i++) {
|
|
89
|
+
var change = changeList_1[_i];
|
|
90
|
+
var changeId = change.id;
|
|
91
|
+
var type = change.type;
|
|
92
|
+
if (change.newValue != null) {
|
|
93
|
+
var root = "".concat(entityOrRelationId, "/").concat(changeId, "/newValue");
|
|
94
|
+
change.newValue = addLineIdToChangeValue(change.newValue, root, type);
|
|
95
|
+
}
|
|
96
|
+
if (change.oldValue != null) {
|
|
97
|
+
var root = "".concat(entityOrRelationId, "/").concat(changeId, "/oldValue");
|
|
98
|
+
change.oldValue = addLineIdToChangeValue(change.oldValue, root, type);
|
|
99
|
+
}
|
|
100
|
+
change.lineIds = ["".concat(entityOrRelationId, "/").concat(changeId)];
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return enrichedData;
|
|
104
|
+
};
|
|
105
|
+
exports.addLineIdToValue = addLineIdToValue;
|
|
@@ -15,6 +15,7 @@ var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
|
15
15
|
var useWorkflowCheckPermission_1 = require("../hooks/useWorkflowCheckPermission");
|
|
16
16
|
var useWorkflowActions_1 = require("../hooks/useWorkflowActions");
|
|
17
17
|
var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
|
|
18
|
+
var context_1 = require("../ChangeRequestEditor/context");
|
|
18
19
|
var ProfileBand_1 = require("../../../ProfileBand");
|
|
19
20
|
var DueDateField_1 = require("../DueDateField");
|
|
20
21
|
var PrioritySelector_1 = require("../PrioritySelector");
|
|
@@ -54,7 +55,8 @@ var ReviewDCRDialog = function (_a) {
|
|
|
54
55
|
react_1.default.createElement("div", { className: ReviewDCRDialog_module_css_1.default.editableItem },
|
|
55
56
|
react_1.default.createElement(AssigneeSelector_1.AssigneeSelector, { taskId: task.taskId, assignee: task.assignee, isTaskOpen: task.isOpen })))),
|
|
56
57
|
react_1.default.createElement("div", { className: ReviewDCRDialog_module_css_1.default.changesSection },
|
|
57
|
-
react_1.default.createElement(
|
|
58
|
+
react_1.default.createElement(context_1.ChangeRequestEditorProvider, null,
|
|
59
|
+
react_1.default.createElement(ChangeRequestEditor_1.ChangeRequestEditor, { dcr: dcr, task: task, groupedObjects: groupedObjects })))),
|
|
58
60
|
canViewComments && (react_1.default.createElement(WorkflowComments_1.WorkflowComments, { workflowActions: workflowActions, actionRequestIsInProgress: actionRequestIsInProgress, preferredAction: task.preferredAction, taskId: task.taskId, processInstanceComments: task.processInstanceComments, isTaskOpen: task.isOpen, showActionButtons: false, alwaysExpanded: true, classes: {
|
|
59
61
|
container: ReviewDCRDialog_module_css_1.default.commentsRootContainer,
|
|
60
62
|
commentsContainer: ReviewDCRDialog_module_css_1.default.commentsContainer
|
|
@@ -64,19 +64,30 @@ var dcrAttributesFactory = function (metadata, attributeType, attributeValue, le
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
+
var extractLineIds = function (attributeValue) {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
return typeof attributeValue.value === 'object' &&
|
|
70
|
+
'newValue' in attributeValue.value &&
|
|
71
|
+
'lineIds' in attributeValue.value.newValue &&
|
|
72
|
+
Array.isArray(attributeValue.value.newValue.lineIds)
|
|
73
|
+
? (_b = (_a = attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.value) === null || _a === void 0 ? void 0 : _a.newValue) === null || _b === void 0 ? void 0 : _b.lineIds
|
|
74
|
+
: attributeValue.lineIds;
|
|
75
|
+
};
|
|
67
76
|
var getNestedAttributeChange = function (metadata, attributeType, attributeValue, level) {
|
|
68
77
|
var attributeTypeList = (0, mdm_sdk_1.getAttributeTypeSubAttributes)({}, attributeType);
|
|
69
78
|
var label = (0, mdm_sdk_1.getLabel)((attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name));
|
|
79
|
+
var lineIds = extractLineIds(attributeValue);
|
|
70
80
|
return [
|
|
71
|
-
{ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue },
|
|
81
|
+
{ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds },
|
|
72
82
|
getAttributesList(metadata, attributeTypeList, attributeValue.value, level + 1)
|
|
73
83
|
];
|
|
74
84
|
};
|
|
75
85
|
var getReferenceAttributeChange = function (metadata, attributeType, attributeValue, level) {
|
|
76
86
|
var attributeTypeList = (0, mdm_sdk_1.getAttributeTypeSubAttributes)(metadata, attributeType);
|
|
77
87
|
var label = (attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name);
|
|
88
|
+
var lineIds = extractLineIds(attributeValue);
|
|
78
89
|
return [
|
|
79
|
-
{ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue },
|
|
90
|
+
{ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds },
|
|
80
91
|
getAttributesList(metadata, attributeTypeList, attributeValue.value, level + 1, true)
|
|
81
92
|
];
|
|
82
93
|
};
|
|
@@ -114,7 +125,7 @@ exports.getRelationChanges = (0, ramda_1.curry)(function (metadata, relationInfo
|
|
|
114
125
|
var relationType = (0, mdm_sdk_1.getRelationType)(metadata, relationInfo.type);
|
|
115
126
|
var attrTypes = (0, mdm_sdk_1.getRelationAttributesList)(metadata, relationInfo.type);
|
|
116
127
|
return (0, ramda_1.flatten)([
|
|
117
|
-
__assign({ level: 1, label: (0, ramda_1.propOr)('', 'label', relationType), attributeType: null, relationType: relationType, attributeValue: __assign(__assign({}, relationInfo), changes) }, addRelationOperationIfNeeded(changes, changeType)),
|
|
128
|
+
__assign({ level: 1, label: (0, ramda_1.propOr)('', 'label', relationType), attributeType: null, relationType: relationType, attributeValue: __assign(__assign({}, relationInfo), changes), lineIds: changes === null || changes === void 0 ? void 0 : changes.lineIds }, addRelationOperationIfNeeded(changes, changeType)),
|
|
118
129
|
getAttributesList(metadata, attrTypes, changes, 2)
|
|
119
130
|
]);
|
|
120
131
|
});
|
|
@@ -32,8 +32,20 @@ describe('attributes helpers tests', function () {
|
|
|
32
32
|
attributeType: 'configuration/entityTypes/HCA/attributes/CountryCode',
|
|
33
33
|
id: '41cb3gGy',
|
|
34
34
|
newPinOrIgnoreValue: true,
|
|
35
|
-
newValue: {
|
|
36
|
-
|
|
35
|
+
newValue: {
|
|
36
|
+
value: 'Chile',
|
|
37
|
+
lookupCode: 'CL',
|
|
38
|
+
lookupRawValue: 'Chile',
|
|
39
|
+
pin: true,
|
|
40
|
+
lineIds: ['3AqlrpfGa/value/newValue']
|
|
41
|
+
},
|
|
42
|
+
oldValue: {
|
|
43
|
+
value: 'Chile',
|
|
44
|
+
lookupCode: 'CL',
|
|
45
|
+
lookupRawValue: 'Chile',
|
|
46
|
+
pin: true,
|
|
47
|
+
lineIds: ['3AqlrpfGa/value/oldValue']
|
|
48
|
+
},
|
|
37
49
|
type: mdm_sdk_1.DCRTypes.IGNORE_ATTRIBUTE
|
|
38
50
|
}
|
|
39
51
|
},
|
|
@@ -44,7 +56,12 @@ describe('attributes helpers tests', function () {
|
|
|
44
56
|
attributeType: 'configuration/entityTypes/HCA/attributes/CountryCode',
|
|
45
57
|
id: '41cb3c0i',
|
|
46
58
|
newPinOrIgnoreValue: false,
|
|
47
|
-
newValue: {
|
|
59
|
+
newValue: {
|
|
60
|
+
value: 'Bahamas',
|
|
61
|
+
lookupCode: 'BS',
|
|
62
|
+
lookupRawValue: 'BS',
|
|
63
|
+
lineIds: ['uri$$1643545710682']
|
|
64
|
+
},
|
|
48
65
|
type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE
|
|
49
66
|
}
|
|
50
67
|
}
|
|
@@ -76,7 +93,7 @@ describe('attributes helpers tests', function () {
|
|
|
76
93
|
attributeType: metadata_test_data_1.metadata.entityTypes[0].attributes[1],
|
|
77
94
|
label: 'Country Code',
|
|
78
95
|
level: 0,
|
|
79
|
-
newValue: changes.CountryCode[0].value.newValue,
|
|
96
|
+
newValue: __assign(__assign({}, changes.CountryCode[0].value.newValue), { lineIds: ['3AqlrpfGa/value/oldValue'] }),
|
|
80
97
|
operation: 'ignored',
|
|
81
98
|
isReferenceSubAttribute: false
|
|
82
99
|
},
|
|
@@ -116,7 +133,12 @@ describe('attributes helpers tests', function () {
|
|
|
116
133
|
};
|
|
117
134
|
var changes = {
|
|
118
135
|
TestAttribute: [{ value: { newValue: '123', type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE } }],
|
|
119
|
-
'activeness.startDate': [
|
|
136
|
+
'activeness.startDate': [
|
|
137
|
+
{
|
|
138
|
+
newValue: { value: 1644001200000, lineIds: ['relations/t58vHMD/activeness/startDate/newValue'] },
|
|
139
|
+
type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE
|
|
140
|
+
}
|
|
141
|
+
]
|
|
120
142
|
};
|
|
121
143
|
it('should not show operation for relation title', function () {
|
|
122
144
|
expect((0, attributes_1.getRelationChanges)(metadata_test_data_1.metadata, relationInfo, changes, mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE)).toEqual([
|
|
@@ -131,7 +153,7 @@ describe('attributes helpers tests', function () {
|
|
|
131
153
|
attributeType: mdm_sdk_1.EntityAttrTypes.startDate,
|
|
132
154
|
label: mdm_sdk_1.EntityAttrTypes.startDate.label,
|
|
133
155
|
level: 2,
|
|
134
|
-
newValue: { value: 1644001200000 },
|
|
156
|
+
newValue: { value: 1644001200000, lineIds: ['relations/t58vHMD/activeness/startDate/newValue'] },
|
|
135
157
|
operation: mdm_sdk_1.DCROperationTypes.ADDED,
|
|
136
158
|
isReferenceSubAttribute: false
|
|
137
159
|
},
|
|
@@ -159,7 +181,7 @@ describe('attributes helpers tests', function () {
|
|
|
159
181
|
attributeType: mdm_sdk_1.EntityAttrTypes.startDate,
|
|
160
182
|
label: mdm_sdk_1.EntityAttrTypes.startDate.label,
|
|
161
183
|
level: 2,
|
|
162
|
-
newValue: { value: 1644001200000 },
|
|
184
|
+
newValue: { value: 1644001200000, lineIds: ['relations/t58vHMD/activeness/startDate/newValue'] },
|
|
163
185
|
operation: mdm_sdk_1.DCROperationTypes.ADDED,
|
|
164
186
|
isReferenceSubAttribute: false
|
|
165
187
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GroupedObjectsInfo, Metadata, EnrichedDCRChanges, EnrichedChangeValue, ChangeValue, DCRChanges } from '@reltio/mdm-sdk';
|
|
2
2
|
import { Diff } from '../types';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const extractLineIds: (value: ChangeValue | EnrichedChangeValue) => string[] | undefined;
|
|
4
|
+
export declare const mergeChanges: (metadata: Metadata, changes: EnrichedDCRChanges | DCRChanges, entityInfo: GroupedObjectsInfo["entity"], relationsInfo: GroupedObjectsInfo["relations"]) => [Diff[], Diff[]];
|