@reltio/components 1.4.2200 → 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/ProfileResizablePanes/ProfileResizablePanes.js +1 -1
- package/ProfileResizablePanes/ProfileResizablePanes.spec.js +16 -2
- package/RequestedData/RequestedData.d.ts +12 -0
- package/RequestedData/RequestedData.js +26 -0
- package/RequestedData/RequestedData.module.css.js +9 -0
- package/RequestedData/index.d.ts +1 -0
- package/RequestedData/index.js +1 -0
- package/cjs/ProfileResizablePanes/ProfileResizablePanes.js +1 -1
- package/cjs/ProfileResizablePanes/ProfileResizablePanes.spec.js +16 -2
- package/cjs/RequestedData/RequestedData.d.ts +12 -0
- package/cjs/RequestedData/RequestedData.js +33 -0
- package/cjs/RequestedData/RequestedData.module.css.js +9 -0
- package/cjs/RequestedData/index.d.ts +1 -0
- package/cjs/RequestedData/index.js +5 -0
- package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +5 -0
- package/cjs/features/activity-log/ActivitiesFactory/components/InteractionActivity/InteractionActivity.d.ts +8 -0
- package/cjs/features/activity-log/ActivitiesFactory/components/InteractionActivity/InteractionActivity.js +20 -0
- package/cjs/features/activity-log/ActivitiesFactory/components/InteractionActivity/index.d.ts +1 -0
- package/cjs/features/activity-log/ActivitiesFactory/components/InteractionActivity/index.js +5 -0
- package/cjs/features/activity-log/ActivityFilterEditor/helpers.test.js +3 -2
- package/cjs/features/activity-log/ActivityLog/helpers.js +1 -1
- package/cjs/features/activity-log/InteractionRecord/InteractionRecord.d.ts +7 -0
- package/cjs/features/activity-log/InteractionRecord/InteractionRecord.js +17 -0
- package/cjs/features/activity-log/InteractionRecord/index.d.ts +1 -0
- package/cjs/features/activity-log/InteractionRecord/index.js +5 -0
- package/cjs/features/activity-log/types.d.ts +3 -1
- package/cjs/features/activity-log/types.js +2 -0
- package/cjs/features/activity-log/utils/activities.js +2 -0
- package/cjs/features/history/types.d.ts +2 -0
- 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/cjs/index.d.ts +1 -0
- package/cjs/index.js +6 -4
- package/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +5 -0
- package/features/activity-log/ActivitiesFactory/components/InteractionActivity/InteractionActivity.d.ts +8 -0
- package/features/activity-log/ActivitiesFactory/components/InteractionActivity/InteractionActivity.js +13 -0
- package/features/activity-log/ActivitiesFactory/components/InteractionActivity/index.d.ts +1 -0
- package/features/activity-log/ActivitiesFactory/components/InteractionActivity/index.js +1 -0
- package/features/activity-log/ActivityFilterEditor/helpers.test.js +3 -2
- package/features/activity-log/ActivityLog/helpers.js +1 -1
- package/features/activity-log/InteractionRecord/InteractionRecord.d.ts +7 -0
- package/features/activity-log/InteractionRecord/InteractionRecord.js +10 -0
- package/features/activity-log/InteractionRecord/index.d.ts +1 -0
- package/features/activity-log/InteractionRecord/index.js +1 -0
- package/features/activity-log/types.d.ts +3 -1
- package/features/activity-log/types.js +2 -0
- package/features/activity-log/utils/activities.js +2 -0
- package/features/history/types.d.ts +2 -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/index.d.ts +1 -0
- package/index.js +1 -0
- 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
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { clone } from 'ramda';
|
|
2
3
|
import i18n from 'ui-i18n';
|
|
3
4
|
import Typography from '@mui/material/Typography';
|
|
5
|
+
import { addLineIdToValue } from './helpers/helpers';
|
|
4
6
|
import SvgSuggestedChanges from '../../../icons/SuggestedChanges';
|
|
5
7
|
import { EntityChangesGroup, SkeletonEntityChangesGroupLoader } from './components/EntityChangesGroup';
|
|
6
8
|
import styles from './ChangeRequestEditor.module.css';
|
|
7
9
|
export var ChangeRequestEditor = function (_a) {
|
|
8
10
|
var dcr = _a.dcr, task = _a.task, groupedObjects = _a.groupedObjects;
|
|
9
|
-
var
|
|
11
|
+
var enrichedDCR = useMemo(function () {
|
|
12
|
+
if (dcr === null || dcr === void 0 ? void 0 : dcr.changes) {
|
|
13
|
+
var cloned = clone(dcr);
|
|
14
|
+
cloned.changes = addLineIdToValue(cloned.changes);
|
|
15
|
+
return cloned;
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}, [dcr]);
|
|
19
|
+
var dcrLoaded = !!enrichedDCR && groupedObjects.length > 0;
|
|
10
20
|
return (React.createElement("div", { className: styles.container },
|
|
11
21
|
React.createElement("div", { className: styles.header },
|
|
12
22
|
React.createElement("div", { className: styles.suggestedChangesIcon },
|
|
13
23
|
React.createElement(SvgSuggestedChanges, null)),
|
|
14
24
|
React.createElement(Typography, { variant: "h6", className: styles.suggestedChangesTitle }, i18n.text('Suggested changes'))),
|
|
15
|
-
dcrLoaded ? (groupedObjects.map(function (object, index) { return (React.createElement(EntityChangesGroup, { key: "entity-".concat(index), entityInfo: object.entity, relationsInfo: object.relations, task: task, dcr:
|
|
25
|
+
dcrLoaded ? (groupedObjects.map(function (object, index) { return (React.createElement(EntityChangesGroup, { key: "entity-".concat(index), entityInfo: object.entity, relationsInfo: object.relations, task: task, dcr: enrichedDCR })); })) : (React.createElement(SkeletonEntityChangesGroupLoader, null))));
|
|
16
26
|
};
|
package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DCRValue } from '@reltio/mdm-sdk';
|
|
3
2
|
import { Diff } from '../../../types';
|
|
4
3
|
type Props = {
|
|
5
4
|
change: Diff;
|
|
6
|
-
onValueChange: (id: string, newValue: DCRValue) => void;
|
|
7
5
|
editable?: boolean;
|
|
8
6
|
};
|
|
9
|
-
export declare const ChangeItemEditor: ({ change,
|
|
7
|
+
export declare const ChangeItemEditor: ({ change, editable }: Props) => React.JSX.Element;
|
|
10
8
|
export {};
|
package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js
CHANGED
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
1
|
import { isNil } from 'ramda';
|
|
2
|
+
import React, { useCallback, useMemo } from 'react';
|
|
3
|
+
import { useContextSelector } from '@fluentui/react-context-selector';
|
|
3
4
|
import { DCROperationTypes, EntityAttrTypes, getAttributeValue } from '@reltio/mdm-sdk';
|
|
5
|
+
import { useMdmMetadata } from '../../../../../contexts/MdmModuleContext';
|
|
6
|
+
import { DataTypeValue } from '../../../../../DataTypeValue';
|
|
4
7
|
import { getDataTypeDefinition, prepareRolesOrTagsValue } from '../../../helpers/common';
|
|
5
8
|
import { OperationChip } from '../../../OperationChip';
|
|
6
|
-
import { DataTypeValue } from '../../../../../DataTypeValue';
|
|
7
9
|
import { RelationEntityLink } from '../../../RelationEntityLink';
|
|
10
|
+
import { ChangeRequestEditorContext } from '../../context';
|
|
8
11
|
import { ChangeItemLabel } from './ChangeItemLabel';
|
|
9
12
|
import { DCRValueEditor } from './DCRValueEditor';
|
|
10
|
-
import {
|
|
13
|
+
import { extractLineIds } from '../../../helpers/merge';
|
|
11
14
|
import styles from './ChangeItemEditor.module.css';
|
|
12
15
|
export var ChangeItemEditor = function (_a) {
|
|
13
16
|
var _b, _c, _d;
|
|
14
|
-
var change = _a.change,
|
|
17
|
+
var change = _a.change, _e = _a.editable, editable = _e === void 0 ? true : _e;
|
|
15
18
|
var metadata = useMdmMetadata();
|
|
19
|
+
var lineIds = change.lineIds || extractLineIds(change === null || change === void 0 ? void 0 : change.newValue);
|
|
20
|
+
var lineData = useContextSelector(ChangeRequestEditorContext, function (context) { return lineIds && context.getLineData(lineIds[0]); });
|
|
21
|
+
var updateChange = useContextSelector(ChangeRequestEditorContext, function (context) { return context.updateChange; });
|
|
22
|
+
var onValueChange = useCallback(function (newValue) {
|
|
23
|
+
updateChange(lineIds, typeof newValue === 'object' && 'value' in newValue ? newValue : { value: newValue });
|
|
24
|
+
}, [lineIds, updateChange]);
|
|
16
25
|
var isUpdateOperation = change.operation === DCROperationTypes.EDITED;
|
|
17
26
|
var isAddOperation = change.operation === DCROperationTypes.ADDED;
|
|
18
27
|
var hasAnyValue = Boolean(change.oldValue || change.newValue);
|
|
19
28
|
var oldValue = getAttributeValue(change.oldValue);
|
|
20
|
-
var newValue = getAttributeValue(change.newValue);
|
|
29
|
+
var newValue = getAttributeValue(isNil(lineData === null || lineData === void 0 ? void 0 : lineData.value) ? change.newValue : lineData.value);
|
|
21
30
|
var hasNewValue = !isNil(newValue);
|
|
22
31
|
var dataTypeDefinition = useMemo(function () {
|
|
23
32
|
return change.attributeType && getDataTypeDefinition(change.attributeType, newValue || oldValue);
|
|
@@ -35,7 +44,7 @@ export var ChangeItemEditor = function (_a) {
|
|
|
35
44
|
React.createElement(ChangeItemLabel, { change: change, className: styles.labelColumn, showLabel: !isUpdateOperation }),
|
|
36
45
|
React.createElement("div", { className: styles.valueColumn },
|
|
37
46
|
React.createElement(RelationEntityLink, { attributeOrRelationType: change.attributeType || change.relationType, attributeValue: change.attributeValue, className: styles.relationEntityLink }),
|
|
38
|
-
shouldShowValueEditor ? (React.createElement(DCRValueEditor, { attributeType: change.attributeType, value: change.newValue, onChange: onValueChange })) : (hasNewValue && (React.createElement("div", { className: styles.value },
|
|
47
|
+
shouldShowValueEditor ? (React.createElement(DCRValueEditor, { attributeType: change.attributeType, value: isNil(lineData === null || lineData === void 0 ? void 0 : lineData.value) ? change.newValue : lineData.value, onChange: onValueChange })) : (hasNewValue && (React.createElement("div", { className: styles.value },
|
|
39
48
|
React.createElement(DataTypeValue, { value: preparedValue, dataTypeDefinition: dataTypeDefinition }))))),
|
|
40
49
|
React.createElement("div", { className: styles.revertColumn }),
|
|
41
50
|
React.createElement("div", { className: styles.operationColumn }, shouldShowOperationChip && (React.createElement(OperationChip, { operation: change.operation, size: "small", variant: "outlined" })))));
|
package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditor.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AttributeType,
|
|
2
|
+
import { AttributeType, ChangeValue, PrimitiveValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
3
|
+
import { LineDataValue } from '../../context';
|
|
3
4
|
type Props = {
|
|
4
5
|
attributeType: AttributeType;
|
|
5
|
-
value: ChangeValue;
|
|
6
|
-
onChange: (
|
|
6
|
+
value: LineDataValue | ChangeValue;
|
|
7
|
+
onChange: (value: SimpleAttributeValue | string[] | PrimitiveValue) => void;
|
|
7
8
|
};
|
|
8
9
|
export declare const DCRValueEditor: ({ attributeType, value, onChange }: Props) => React.JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { DCRValueEditorFactory } from './DCRValueEditorFactory';
|
|
3
3
|
import styles from './ChangeItemEditor.module.css';
|
|
4
4
|
export var DCRValueEditor = function (_a) {
|
|
5
5
|
var attributeType = _a.attributeType, value = _a.value, onChange = _a.onChange;
|
|
6
|
-
var handleChange = useCallback(function (updatedValue) {
|
|
7
|
-
onChange(attributeType.uri, updatedValue);
|
|
8
|
-
}, [attributeType.uri, onChange]);
|
|
9
6
|
return (React.createElement("div", { className: styles.editor }, DCRValueEditorFactory.build({
|
|
10
7
|
attributeType: attributeType,
|
|
11
8
|
value: value,
|
|
12
|
-
onChange:
|
|
9
|
+
onChange: onChange
|
|
13
10
|
})));
|
|
14
11
|
};
|
package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditorFactory.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AttributeType,
|
|
2
|
+
import { AttributeType, ChangeValue, DataTypeDefinition, PrimitiveValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
3
|
+
import { LineDataValue } from '../../context';
|
|
3
4
|
type Props = {
|
|
4
5
|
attributeType: AttributeType;
|
|
5
|
-
value: ChangeValue;
|
|
6
|
-
onChange: (value:
|
|
6
|
+
value: LineDataValue | ChangeValue;
|
|
7
|
+
onChange: (value: SimpleAttributeValue | string[] | PrimitiveValue) => void;
|
|
7
8
|
dataTypeDefinition?: DataTypeDefinition;
|
|
8
9
|
};
|
|
9
10
|
export declare class DCRValueEditorFactory {
|
package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditorFactory.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { prop } from 'ramda';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import { EntityAttrTypes,
|
|
3
|
+
import { EntityAttrTypes, getAttributeValue, wrapInArrayIfNeeded } from '@reltio/mdm-sdk';
|
|
3
4
|
import { DataTypeValueEditor } from '../../../../../DataTypeValueEditor';
|
|
4
|
-
import { attributeValueToEditorValue } from '../../../../../helpers/attributesView';
|
|
5
|
-
import { getDataTypeDefinition } from '../../../helpers/common';
|
|
5
|
+
import { attributeValueToEditorValue, editorValueToAttributeValue } from '../../../../../helpers/attributesView';
|
|
6
6
|
import { RolesInput } from '../../../../../RolesInput/RolesInput';
|
|
7
7
|
import { TagsInput } from '../../../../../TagsInput/TagsInput';
|
|
8
|
+
import { getDataTypeDefinition } from '../../../helpers/common';
|
|
8
9
|
var DCRValueEditorFactory = /** @class */ (function () {
|
|
9
10
|
function DCRValueEditorFactory() {
|
|
10
11
|
}
|
|
@@ -13,7 +14,10 @@ var DCRValueEditorFactory = /** @class */ (function () {
|
|
|
13
14
|
var dcrValue = getAttributeValue(value);
|
|
14
15
|
switch (attributeType.uri) {
|
|
15
16
|
case EntityAttrTypes.roles.uri: {
|
|
16
|
-
|
|
17
|
+
var handleChange = function (values) {
|
|
18
|
+
onChange((values === null || values === void 0 ? void 0 : values.map(prop('value'))) || []);
|
|
19
|
+
};
|
|
20
|
+
return React.createElement(RolesInput, { value: wrapInArrayIfNeeded(dcrValue), onChange: handleChange });
|
|
17
21
|
}
|
|
18
22
|
case EntityAttrTypes.tags.uri: {
|
|
19
23
|
return React.createElement(TagsInput, { value: wrapInArrayIfNeeded(dcrValue), onChange: onChange });
|
|
@@ -23,7 +27,11 @@ var DCRValueEditorFactory = /** @class */ (function () {
|
|
|
23
27
|
var editorValue = value && dataTypeDefinition
|
|
24
28
|
? attributeValueToEditorValue(value, dataTypeDefinition)
|
|
25
29
|
: null;
|
|
26
|
-
|
|
30
|
+
var handleChange = function (value) {
|
|
31
|
+
var valueConvertedToAttributeValue = editorValueToAttributeValue(attributeType, value);
|
|
32
|
+
onChange(valueConvertedToAttributeValue);
|
|
33
|
+
};
|
|
34
|
+
return (React.createElement(DataTypeValueEditor, { fieldName: attributeType.uri, value: editorValue, dataTypeDefinition: dataTypeDefinition, onChange: handleChange, fullWidth: true }));
|
|
27
35
|
}
|
|
28
36
|
}
|
|
29
37
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { GroupedObjectsInfo
|
|
2
|
+
import { GroupedObjectsInfo } from '@reltio/mdm-sdk';
|
|
3
3
|
import { Diff, Title } from '../../../types';
|
|
4
4
|
type Props = {
|
|
5
5
|
item: Diff | Title;
|
|
6
|
-
onValueChange: (id: string, newValue: DCRValue) => void;
|
|
7
6
|
entityInfo: GroupedObjectsInfo['entity'];
|
|
8
7
|
};
|
|
9
|
-
export declare const ChangeItemRow: ({ item,
|
|
8
|
+
export declare const ChangeItemRow: ({ item, entityInfo }: Props) => React.JSX.Element;
|
|
10
9
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { has } from 'ramda';
|
|
3
1
|
import classnames from 'classnames';
|
|
2
|
+
import { has } from 'ramda';
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { DCROperationTypes } from '@reltio/mdm-sdk';
|
|
5
|
-
import { isEditableChange } from '../../helpers';
|
|
6
|
-
import {
|
|
5
|
+
import { isEditableChange } from '../../helpers/helpers';
|
|
6
|
+
import { ChangeItemEditor, ChangeItemOldValue } from '../ChangeItemEditor';
|
|
7
7
|
import styles from './ChangeItemRow.module.css';
|
|
8
8
|
export var ChangeItemRow = function (_a) {
|
|
9
9
|
var _b;
|
|
10
|
-
var item = _a.item,
|
|
10
|
+
var item = _a.item, entityInfo = _a.entityInfo;
|
|
11
11
|
if (!has('level', item)) {
|
|
12
12
|
return React.createElement("div", { className: styles.title }, item.label);
|
|
13
13
|
}
|
|
@@ -16,5 +16,5 @@ export var ChangeItemRow = function (_a) {
|
|
|
16
16
|
var editable = isEditableChange(change, entityInfo);
|
|
17
17
|
return (React.createElement("div", { className: classnames(styles.changeItemRow, (_b = {}, _b[styles.editableRow] = editable, _b)) },
|
|
18
18
|
isEditedOperation && React.createElement(ChangeItemOldValue, { change: change }),
|
|
19
|
-
React.createElement(ChangeItemEditor, { change: change,
|
|
19
|
+
React.createElement(ChangeItemEditor, { change: change, editable: editable })));
|
|
20
20
|
};
|
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;
|