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