@reltio/components 1.4.2243 → 1.4.2244
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/ActivenessDateControl/ActivenessDateControl.d.ts +9 -0
- package/ActivenessDateControl/ActivenessDateControl.js +11 -0
- package/ActivenessDateControl/index.d.ts +1 -0
- package/ActivenessDateControl/index.js +1 -0
- package/EntitySelector/EntitySelector.d.ts +2 -1
- package/EntitySelector/EntitySelector.js +2 -2
- package/EntitySelector/index.d.ts +1 -0
- package/MoreAttributesButton/MoreAttributesButton.d.ts +3 -2
- package/MoreAttributesButton/MoreAttributesButton.js +8 -8
- package/MoreAttributesButton/useMoreAttributesItems.d.ts +4 -4
- package/cjs/ActivenessDateControl/ActivenessDateControl.d.ts +9 -0
- package/cjs/ActivenessDateControl/ActivenessDateControl.js +18 -0
- package/cjs/ActivenessDateControl/index.d.ts +1 -0
- package/cjs/ActivenessDateControl/index.js +5 -0
- package/cjs/EntitySelector/EntitySelector.d.ts +2 -1
- package/cjs/EntitySelector/EntitySelector.js +2 -2
- package/cjs/EntitySelector/index.d.ts +1 -0
- package/cjs/MoreAttributesButton/MoreAttributesButton.d.ts +3 -2
- package/cjs/MoreAttributesButton/MoreAttributesButton.js +8 -8
- package/cjs/MoreAttributesButton/useMoreAttributesItems.d.ts +4 -4
- package/cjs/features/activity-log/ActivityLog/ActivityLog.test.js +28 -0
- package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.js +22 -11
- package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.module.css.js +9 -0
- package/cjs/features/activity-log/ActivityLog/constants.d.ts +17 -0
- package/cjs/features/activity-log/ActivityLog/constants.js +20 -0
- package/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +20 -9
- package/cjs/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.d.ts +7 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.js +67 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.js +3 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.module.css.js +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +25 -6
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.d.ts +9 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.js +79 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.js +5 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.js +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.d.ts +11 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.js +41 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.module.css.js +9 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.js +6 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +134 -5
- package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/SkeletonEntityChangesGroupLoader.js +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/ChangeItemEditor.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.js +110 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.module.css.js +9 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.js +6 -5
- package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.d.ts +0 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.js +1 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.d.ts +8 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.js +89 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.js +5 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.js +12 -11
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/ChangeItemOldValue.module.css.js +9 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.js +5 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.d.ts +11 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.js +34 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.module.css.js +9 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.js +5 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/editors.module.css.js +9 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/index.d.ts +4 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/index.js +12 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/addedAttributes.d.ts +11 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/addedAttributes.js +74 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.d.ts +2 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.js +157 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test.js +203 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +6 -3
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.js +22 -3
- package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.d.ts +3 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.js +190 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.js +768 -0
- package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +4 -3
- package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +9 -1
- package/cjs/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.d.ts +18 -0
- package/cjs/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.js +65 -0
- package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +7 -3
- package/cjs/features/workflow/contexts/AddedAttributesContext/index.d.ts +39 -0
- package/cjs/features/workflow/contexts/AddedAttributesContext/index.js +152 -0
- package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +3 -2
- package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.js +47 -7
- package/cjs/features/workflow/contexts/ScrollToAddedAttributeContext/index.d.ts +11 -0
- package/cjs/features/workflow/contexts/ScrollToAddedAttributeContext/index.js +78 -0
- package/cjs/features/workflow/helpers/attributes.js +16 -13
- package/cjs/features/workflow/helpers/attributes.test.js +6 -3
- package/cjs/features/workflow/helpers/dcr.d.ts +6 -1
- package/cjs/features/workflow/helpers/dcr.js +113 -18
- package/cjs/features/workflow/helpers/dcr.test.js +122 -0
- package/cjs/features/workflow/helpers/merge.d.ts +3 -0
- package/cjs/features/workflow/helpers/merge.js +32 -20
- package/cjs/features/workflow/helpers/merge.test.js +2 -1
- package/cjs/features/workflow/helpers/moreAttributesScope.d.ts +4 -0
- package/cjs/features/workflow/helpers/moreAttributesScope.js +20 -0
- package/cjs/features/workflow/helpers/validation.js +31 -6
- package/cjs/features/workflow/hooks/useApplyDcrChanges.d.ts +2 -2
- package/cjs/features/workflow/hooks/useApplyDcrChanges.js +80 -63
- package/cjs/features/workflow/types.d.ts +12 -2
- package/features/activity-log/ActivityLog/ActivityLog.test.js +28 -0
- package/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.js +15 -4
- package/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.module.css.js +9 -0
- package/features/activity-log/ActivityLog/constants.d.ts +17 -0
- package/features/activity-log/ActivityLog/constants.js +17 -0
- package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +20 -9
- package/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.d.ts +7 -0
- package/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.js +37 -0
- package/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.js +3 -1
- package/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.module.css.js +2 -2
- package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +2 -2
- package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +26 -7
- package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
- package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.d.ts +9 -0
- package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.js +49 -0
- package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.js +1 -0
- package/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +2 -2
- package/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.js +2 -2
- package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.d.ts +11 -0
- package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.js +34 -0
- package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.module.css.js +9 -0
- package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.js +1 -0
- package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +112 -6
- package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/SkeletonEntityChangesGroupLoader.js +1 -1
- package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/ChangeItemEditor.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.js +80 -0
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.module.css.js +9 -0
- package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.js +6 -5
- package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.d.ts +0 -1
- package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.js +0 -1
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.d.ts +8 -0
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.js +59 -0
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.js +1 -0
- package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.js +10 -9
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/ChangeItemOldValue.module.css.js +9 -0
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.js +1 -0
- package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.d.ts +11 -0
- package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.js +27 -0
- package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.module.css.js +9 -0
- package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.js +1 -0
- package/features/workflow/ChangeRequestEditor/components/editors/editors.module.css.js +9 -0
- package/features/workflow/ChangeRequestEditor/components/editors/index.d.ts +4 -0
- package/features/workflow/ChangeRequestEditor/components/editors/index.js +4 -0
- package/features/workflow/ChangeRequestEditor/helpers/addedAttributes.d.ts +11 -0
- package/features/workflow/ChangeRequestEditor/helpers/addedAttributes.js +62 -0
- package/features/workflow/ChangeRequestEditor/helpers/changesList.d.ts +2 -0
- package/features/workflow/ChangeRequestEditor/helpers/changesList.js +153 -0
- package/features/workflow/ChangeRequestEditor/helpers/changesList.test.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/helpers/changesList.test.js +201 -0
- package/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +6 -3
- package/features/workflow/ChangeRequestEditor/helpers/helpers.js +19 -3
- package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.d.ts +3 -0
- package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.js +186 -0
- package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.js +766 -0
- package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +4 -3
- package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +9 -1
- package/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.d.ts +18 -0
- package/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.js +61 -0
- package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +7 -3
- package/features/workflow/contexts/AddedAttributesContext/index.d.ts +39 -0
- package/features/workflow/contexts/AddedAttributesContext/index.js +125 -0
- package/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +3 -2
- package/features/workflow/contexts/ChangeRequestEditorContext/index.js +47 -7
- package/features/workflow/contexts/ScrollToAddedAttributeContext/index.d.ts +11 -0
- package/features/workflow/contexts/ScrollToAddedAttributeContext/index.js +51 -0
- package/features/workflow/helpers/attributes.js +16 -13
- package/features/workflow/helpers/attributes.test.js +6 -3
- package/features/workflow/helpers/dcr.d.ts +6 -1
- package/features/workflow/helpers/dcr.js +112 -18
- package/features/workflow/helpers/dcr.test.js +123 -1
- package/features/workflow/helpers/merge.d.ts +3 -0
- package/features/workflow/helpers/merge.js +30 -19
- package/features/workflow/helpers/merge.test.js +2 -1
- package/features/workflow/helpers/moreAttributesScope.d.ts +4 -0
- package/features/workflow/helpers/moreAttributesScope.js +14 -0
- package/features/workflow/helpers/validation.js +31 -6
- package/features/workflow/hooks/useApplyDcrChanges.d.ts +2 -2
- package/features/workflow/hooks/useApplyDcrChanges.js +83 -66
- package/features/workflow/types.d.ts +12 -2
- package/package.json +2 -2
- package/cjs/features/activity-log/ActivityLog/components/ActivityItem/styles.d.ts +0 -1
- package/cjs/features/activity-log/ActivityLog/components/ActivityItem/styles.js +0 -57
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +0 -95
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.module.css.js +0 -9
- package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.d.ts +0 -7
- package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.js +0 -21
- package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.module.css.js +0 -9
- package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/index.d.ts +0 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/index.js +0 -5
- package/features/activity-log/ActivityLog/components/ActivityItem/styles.d.ts +0 -1
- package/features/activity-log/ActivityLog/components/ActivityItem/styles.js +0 -54
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +0 -65
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.module.css.js +0 -9
- package/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.d.ts +0 -7
- package/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.js +0 -14
- package/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.module.css.js +0 -9
- package/features/workflow/ChangeRequestEditor/components/StatusChips/index.d.ts +0 -1
- package/features/workflow/ChangeRequestEditor/components/StatusChips/index.js +0 -1
- /package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.d.ts +0 -0
- /package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PrimitiveValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
2
|
-
import { Diff } from '../../types';
|
|
1
|
+
import { type PrimitiveValue, type SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
2
|
+
import type { Diff, LineDataValue } from '../../types';
|
|
3
3
|
type Props = {
|
|
4
4
|
change: Diff;
|
|
5
5
|
};
|
|
@@ -7,11 +7,12 @@ export declare const useChangeRequestEditor: ({ change }: Props) => {
|
|
|
7
7
|
handleChange: (newValue: SimpleAttributeValue | string[] | PrimitiveValue) => void;
|
|
8
8
|
handleReject: () => void;
|
|
9
9
|
handleRevert: () => void;
|
|
10
|
+
handleImageUpload: (value: LineDataValue) => void;
|
|
10
11
|
lineData: import("../../types").LineData;
|
|
11
12
|
isLineRejected: boolean;
|
|
12
13
|
isParentLineRejected: boolean;
|
|
13
14
|
isUpdated: boolean;
|
|
14
15
|
hasChangeId: boolean;
|
|
15
|
-
isSubAttributeOfDeletedAttribute:
|
|
16
|
+
isSubAttributeOfDeletedAttribute: boolean;
|
|
16
17
|
};
|
|
17
18
|
export {};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
+
import { isEmpty } from 'ramda';
|
|
2
3
|
import { useContextSelector } from '@fluentui/react-context-selector';
|
|
3
4
|
import { DCROperationTypes } from '@reltio/mdm-sdk';
|
|
4
5
|
import { ChangeRequestEditorContext } from '../../contexts/ChangeRequestEditorContext';
|
|
5
6
|
import { extractLineIds } from '../../helpers/merge';
|
|
7
|
+
import { isSimpleAttributeValue } from '../helpers/helpers';
|
|
6
8
|
var emptyLineIds = [];
|
|
7
9
|
export var useChangeRequestEditor = function (_a) {
|
|
8
10
|
var change = _a.change;
|
|
@@ -22,7 +24,7 @@ export var useChangeRequestEditor = function (_a) {
|
|
|
22
24
|
lineIds.length > 0 &&
|
|
23
25
|
lineIds[0].includes('/value/');
|
|
24
26
|
var handleChange = useCallback(function (newValue) {
|
|
25
|
-
updateChange(lineIds,
|
|
27
|
+
updateChange(lineIds, isSimpleAttributeValue(newValue) ? newValue : { value: newValue });
|
|
26
28
|
}, [lineIds, updateChange]);
|
|
27
29
|
var handleReject = useCallback(function () {
|
|
28
30
|
rejectChange(lineIds);
|
|
@@ -30,10 +32,16 @@ export var useChangeRequestEditor = function (_a) {
|
|
|
30
32
|
var handleRevert = useCallback(function () {
|
|
31
33
|
revertChangeUpdateOrReject(lineIds);
|
|
32
34
|
}, [revertChangeUpdateOrReject, lineIds]);
|
|
35
|
+
var handleImageUpload = useCallback(function (value) {
|
|
36
|
+
if (isEmpty(lineIds))
|
|
37
|
+
return;
|
|
38
|
+
updateChange(lineIds, value);
|
|
39
|
+
}, [lineIds, updateChange]);
|
|
33
40
|
return {
|
|
34
41
|
handleChange: handleChange,
|
|
35
42
|
handleReject: handleReject,
|
|
36
43
|
handleRevert: handleRevert,
|
|
44
|
+
handleImageUpload: handleImageUpload,
|
|
37
45
|
lineData: lineData,
|
|
38
46
|
isLineRejected: isLineRejected,
|
|
39
47
|
isParentLineRejected: isParentLineRejected,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PrimitiveValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
2
|
+
import type { Diff, LineDataValue } from '../../types';
|
|
3
|
+
import type { EntityOption } from '../../../../EntitySelector/types';
|
|
4
|
+
type Props = {
|
|
5
|
+
change: Diff;
|
|
6
|
+
};
|
|
7
|
+
export declare const useNewAttributesEditor: ({ change }: Props) => {
|
|
8
|
+
lineData: import("../../types").LineData;
|
|
9
|
+
addedId: string;
|
|
10
|
+
selectedEntity: import("@reltio/mdm-sdk").ConnectionEntity;
|
|
11
|
+
isRejected: boolean;
|
|
12
|
+
hasAddedParent: boolean;
|
|
13
|
+
handleDelete: () => void;
|
|
14
|
+
handleChange: (newValue: SimpleAttributeValue | string[] | PrimitiveValue) => void;
|
|
15
|
+
handleEntityChange: (entity: EntityOption) => void;
|
|
16
|
+
handleImageUpload: (value: LineDataValue) => void;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useContextSelector } from '@fluentui/react-context-selector';
|
|
3
|
+
import { ChangeRequestEditorContext } from '../../contexts/ChangeRequestEditorContext';
|
|
4
|
+
import { extractLineIds } from '../../helpers/merge';
|
|
5
|
+
import { isSimpleAttributeValue } from '../helpers/helpers';
|
|
6
|
+
import { getAddedId, hasParentAddedAttribute } from '../helpers/addedAttributes';
|
|
7
|
+
import { AddedAttributesContext } from '../../contexts/AddedAttributesContext';
|
|
8
|
+
var emptyLineIds = [];
|
|
9
|
+
export var useNewAttributesEditor = function (_a) {
|
|
10
|
+
var change = _a.change;
|
|
11
|
+
var addedId = getAddedId(change);
|
|
12
|
+
var hasAddedParent = hasParentAddedAttribute(addedId);
|
|
13
|
+
var lineIds = change.lineIds || extractLineIds(change === null || change === void 0 ? void 0 : change.newValue) || emptyLineIds;
|
|
14
|
+
var lineData = useContextSelector(ChangeRequestEditorContext, function (context) { return context.getLineData(lineIds[0]); });
|
|
15
|
+
var updateChange = useContextSelector(ChangeRequestEditorContext, function (context) { return context.updateChange; });
|
|
16
|
+
var isLineRejected = useContextSelector(ChangeRequestEditorContext, function (context) {
|
|
17
|
+
return context.getIsLineRejected(lineIds[0]);
|
|
18
|
+
});
|
|
19
|
+
var isParentLineRejected = useContextSelector(ChangeRequestEditorContext, function (context) {
|
|
20
|
+
return context.getIsParentLineRejected(lineIds[0]);
|
|
21
|
+
});
|
|
22
|
+
var isRejected = isLineRejected || isParentLineRejected;
|
|
23
|
+
var deleteLineData = useContextSelector(ChangeRequestEditorContext, function (ctx) { return ctx.deleteLineData; });
|
|
24
|
+
var removeAddedAttribute = useContextSelector(AddedAttributesContext, function (ctx) { return ctx.removeAddedAttribute; });
|
|
25
|
+
var updateAddedAttributeRefEntity = useContextSelector(AddedAttributesContext, function (ctx) { return ctx.updateAddedAttributeRefEntity; });
|
|
26
|
+
var selectedEntity = useContextSelector(AddedAttributesContext, function (ctx) { var _a; return addedId ? (_a = ctx.getAddedAttributes().find(function (a) { return a.id === addedId; })) === null || _a === void 0 ? void 0 : _a.refEntity : undefined; });
|
|
27
|
+
var handleChange = useCallback(function (newValue) {
|
|
28
|
+
updateChange(lineIds, isSimpleAttributeValue(newValue) ? newValue : { value: newValue });
|
|
29
|
+
}, [lineIds, updateChange]);
|
|
30
|
+
var handleDelete = useCallback(function () {
|
|
31
|
+
if (!addedId)
|
|
32
|
+
return;
|
|
33
|
+
removeAddedAttribute(addedId);
|
|
34
|
+
deleteLineData(lineIds);
|
|
35
|
+
}, [addedId, deleteLineData, lineIds, removeAddedAttribute]);
|
|
36
|
+
var handleEntityChange = useCallback(function (entity) {
|
|
37
|
+
if (!addedId)
|
|
38
|
+
return;
|
|
39
|
+
updateAddedAttributeRefEntity(addedId, {
|
|
40
|
+
entityUri: entity.uri,
|
|
41
|
+
entityType: entity.type,
|
|
42
|
+
entityLabel: entity.label
|
|
43
|
+
});
|
|
44
|
+
}, [addedId, updateAddedAttributeRefEntity]);
|
|
45
|
+
var handleImageUpload = useCallback(function (value) {
|
|
46
|
+
if (lineIds.length === 0)
|
|
47
|
+
return;
|
|
48
|
+
updateChange(lineIds, value);
|
|
49
|
+
}, [lineIds, updateChange]);
|
|
50
|
+
return {
|
|
51
|
+
lineData: lineData,
|
|
52
|
+
addedId: addedId,
|
|
53
|
+
selectedEntity: selectedEntity,
|
|
54
|
+
isRejected: isRejected,
|
|
55
|
+
hasAddedParent: hasAddedParent,
|
|
56
|
+
handleDelete: handleDelete,
|
|
57
|
+
handleChange: handleChange,
|
|
58
|
+
handleEntityChange: handleEntityChange,
|
|
59
|
+
handleImageUpload: handleImageUpload
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -10,7 +10,9 @@ import { useChangeRequest } from '../../../hooks/useChangeRequest';
|
|
|
10
10
|
import { getDCRUri } from '../../../helpers/common';
|
|
11
11
|
import { ReviewDCRDialog } from '../../../ReviewDCRDialog';
|
|
12
12
|
import { ReviewDCRButton } from '../../../ReviewDCRButton';
|
|
13
|
+
import { AddedAttributesProvider } from '../../../contexts/AddedAttributesContext';
|
|
13
14
|
import { ChangeRequestEditorProvider } from '../../../contexts/ChangeRequestEditorContext';
|
|
15
|
+
import { ScrollToAddedAttributeProvider } from '../../../contexts/ScrollToAddedAttributeContext';
|
|
14
16
|
import { WorkflowTasksContext } from '../../../../../contexts/WorkflowTasksContext';
|
|
15
17
|
import { ScrollToElementProvider } from '../../../../../contexts/ScrollToElementContext';
|
|
16
18
|
export var DataChangeRequestTaskCard = function (_a) {
|
|
@@ -38,7 +40,9 @@ export var DataChangeRequestTaskCard = function (_a) {
|
|
|
38
40
|
React.createElement(GenericWorkflowTaskCard, { task: task, Icon: DcrTaskIcon, customActionsSlot: customActionsSlot }, dcr &&
|
|
39
41
|
groupedObjects.map(function (object, index) { return (React.createElement(LineDecorator, { key: index, last: index === groupedObjects.length - 1, divider: true },
|
|
40
42
|
React.createElement(AttributesChanges, { entityInfo: object.entity, relationsInfo: object.relations, changes: dcr.changes, objectsInfo: dcr.objectsInfo, dcrUri: dcrUri }))); })),
|
|
41
|
-
showReviewDialog && (React.createElement(
|
|
42
|
-
React.createElement(
|
|
43
|
-
React.createElement(
|
|
43
|
+
showReviewDialog && (React.createElement(AddedAttributesProvider, null,
|
|
44
|
+
React.createElement(ChangeRequestEditorProvider, null,
|
|
45
|
+
React.createElement(ScrollToElementProvider, null,
|
|
46
|
+
React.createElement(ScrollToAddedAttributeProvider, null,
|
|
47
|
+
React.createElement(ReviewDCRDialog, { open: isReviewDCRDialogOpen, onClose: handleCloseReviewDCRDialog, dcr: dcr, groupedObjects: groupedObjects, task: task }))))))));
|
|
44
48
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type AttributeType, type ConnectionEntity } from '@reltio/mdm-sdk';
|
|
3
|
+
export declare const ADDED_ID_SEPARATOR = "|";
|
|
4
|
+
export declare const ADDED_CHANGE_ID_PREFIX = "added|";
|
|
5
|
+
export type ChangeOverrides = {
|
|
6
|
+
attributePath?: string;
|
|
7
|
+
refAttributeType?: string;
|
|
8
|
+
refObjectURI?: string;
|
|
9
|
+
};
|
|
10
|
+
export type AddedAttributeInitialValue = {
|
|
11
|
+
value?: unknown;
|
|
12
|
+
lookupCode?: string;
|
|
13
|
+
};
|
|
14
|
+
export type AddedAttribute = {
|
|
15
|
+
attributeType: AttributeType;
|
|
16
|
+
id: string;
|
|
17
|
+
objectUri?: string;
|
|
18
|
+
parentLineId?: string;
|
|
19
|
+
parentId?: string;
|
|
20
|
+
changeOverrides?: ChangeOverrides;
|
|
21
|
+
initialValue?: AddedAttributeInitialValue;
|
|
22
|
+
refEntity?: ConnectionEntity;
|
|
23
|
+
};
|
|
24
|
+
export type AddedAttributesContextType = {
|
|
25
|
+
getAddedAttributes: () => AddedAttribute[];
|
|
26
|
+
addAddedAttributes: ({ attributeTypes, objectUri, parentLineId, parentId, changeOverrides }: {
|
|
27
|
+
attributeTypes: AttributeType[];
|
|
28
|
+
objectUri?: string;
|
|
29
|
+
parentLineId?: string;
|
|
30
|
+
parentId?: string;
|
|
31
|
+
changeOverrides?: ChangeOverrides;
|
|
32
|
+
}) => string[];
|
|
33
|
+
removeAddedAttribute: (id: string) => void;
|
|
34
|
+
updateAddedAttributeRefEntity: (id: string, refEntity: ConnectionEntity) => void;
|
|
35
|
+
};
|
|
36
|
+
export declare const AddedAttributesContext: import("@fluentui/react-context-selector").Context<AddedAttributesContextType>;
|
|
37
|
+
export declare const AddedAttributesProvider: ({ children }: {
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,125 @@
|
|
|
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
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
21
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
22
|
+
import { createContext } from '@fluentui/react-context-selector';
|
|
23
|
+
import { nanoid } from 'nanoid';
|
|
24
|
+
import { createNewAttributeValue, isComplexAttribute, isImage } from '@reltio/mdm-sdk';
|
|
25
|
+
import { useMdmMetadata } from '../../../../contexts/MdmModuleContext';
|
|
26
|
+
import { getAvailableSubAttributesForNestedOrReference } from '../../helpers/moreAttributesScope';
|
|
27
|
+
export var ADDED_ID_SEPARATOR = '|';
|
|
28
|
+
export var ADDED_CHANGE_ID_PREFIX = "added".concat(ADDED_ID_SEPARATOR);
|
|
29
|
+
export var AddedAttributesContext = createContext({
|
|
30
|
+
getAddedAttributes: undefined,
|
|
31
|
+
addAddedAttributes: undefined,
|
|
32
|
+
removeAddedAttribute: undefined,
|
|
33
|
+
updateAddedAttributeRefEntity: undefined
|
|
34
|
+
});
|
|
35
|
+
var getInitialAttributeValue = function (attrType) {
|
|
36
|
+
if (isComplexAttribute(attrType) || isImage(attrType))
|
|
37
|
+
return undefined;
|
|
38
|
+
var _a = createNewAttributeValue(attrType), value = _a.value, lookupCode = _a.lookupCode;
|
|
39
|
+
if (value === '' && !lookupCode)
|
|
40
|
+
return undefined;
|
|
41
|
+
return lookupCode ? { value: value, lookupCode: lookupCode } : { value: value };
|
|
42
|
+
};
|
|
43
|
+
var generateAddedAttributeId = function (parentId) {
|
|
44
|
+
return parentId ? "".concat(parentId).concat(ADDED_ID_SEPARATOR).concat(nanoid()) : "".concat(ADDED_CHANGE_ID_PREFIX).concat(nanoid());
|
|
45
|
+
};
|
|
46
|
+
var createAddedAttribute = function (_a) {
|
|
47
|
+
var attributeType = _a.attributeType, objectUri = _a.objectUri, parentLineId = _a.parentLineId, parentId = _a.parentId, changeOverrides = _a.changeOverrides;
|
|
48
|
+
var finalChangeOverrides = changeOverrides
|
|
49
|
+
? __assign(__assign(__assign({}, changeOverrides), (changeOverrides.attributePath && {
|
|
50
|
+
attributePath: "".concat(changeOverrides.attributePath, "/").concat(attributeType.name)
|
|
51
|
+
})), (changeOverrides.refAttributeType && {
|
|
52
|
+
refAttributeType: "".concat(changeOverrides.refAttributeType, "/attributes/").concat(attributeType.name)
|
|
53
|
+
})) : undefined;
|
|
54
|
+
var initialValue = getInitialAttributeValue(attributeType);
|
|
55
|
+
return __assign({ attributeType: attributeType, id: generateAddedAttributeId(parentId), objectUri: objectUri, parentLineId: parentLineId, parentId: parentId, changeOverrides: finalChangeOverrides }, (initialValue && { initialValue: initialValue }));
|
|
56
|
+
};
|
|
57
|
+
export var AddedAttributesProvider = function (_a) {
|
|
58
|
+
var children = _a.children;
|
|
59
|
+
var metadata = useMdmMetadata();
|
|
60
|
+
var _b = useState([]), state = _b[0], setState = _b[1];
|
|
61
|
+
var getAddedAttributes = useCallback(function () { return state; }, [state]);
|
|
62
|
+
var createAddedAttributes = useCallback(function (_a) {
|
|
63
|
+
var attributeType = _a.attributeType, objectUri = _a.objectUri, parentLineId = _a.parentLineId, parentId = _a.parentId, changeOverrides = _a.changeOverrides;
|
|
64
|
+
var addedAttribute = createAddedAttribute({
|
|
65
|
+
attributeType: attributeType,
|
|
66
|
+
objectUri: objectUri,
|
|
67
|
+
parentLineId: parentLineId,
|
|
68
|
+
parentId: parentId,
|
|
69
|
+
changeOverrides: changeOverrides
|
|
70
|
+
});
|
|
71
|
+
var result = [addedAttribute];
|
|
72
|
+
if (isComplexAttribute(attributeType)) {
|
|
73
|
+
var subAttributes = getAvailableSubAttributesForNestedOrReference(metadata, attributeType);
|
|
74
|
+
for (var _i = 0, subAttributes_1 = subAttributes; _i < subAttributes_1.length; _i++) {
|
|
75
|
+
var attr = subAttributes_1[_i];
|
|
76
|
+
if (attr.required) {
|
|
77
|
+
result.push.apply(result, createAddedAttributes({
|
|
78
|
+
attributeType: attr,
|
|
79
|
+
objectUri: objectUri,
|
|
80
|
+
parentId: addedAttribute.id
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
result.push(createAddedAttribute({
|
|
85
|
+
attributeType: attr,
|
|
86
|
+
objectUri: objectUri,
|
|
87
|
+
parentId: addedAttribute.id
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
93
|
+
}, [metadata]);
|
|
94
|
+
var addAddedAttributes = useCallback(function (_a) {
|
|
95
|
+
var attributeTypes = _a.attributeTypes, objectUri = _a.objectUri, parentLineId = _a.parentLineId, parentId = _a.parentId, changeOverrides = _a.changeOverrides;
|
|
96
|
+
if (attributeTypes.length === 0)
|
|
97
|
+
return [];
|
|
98
|
+
var addedIds = [];
|
|
99
|
+
setState(function (prev) {
|
|
100
|
+
var newAddedAttributes = attributeTypes.flatMap(function (attributeType) {
|
|
101
|
+
return createAddedAttributes({ attributeType: attributeType, objectUri: objectUri, parentLineId: parentLineId, parentId: parentId, changeOverrides: changeOverrides });
|
|
102
|
+
});
|
|
103
|
+
addedIds.push.apply(addedIds, newAddedAttributes.map(function (attr) { return attr.id; }));
|
|
104
|
+
return __spreadArray(__spreadArray([], prev, true), newAddedAttributes, true);
|
|
105
|
+
});
|
|
106
|
+
return addedIds;
|
|
107
|
+
}, [createAddedAttributes]);
|
|
108
|
+
var removeAddedAttribute = useCallback(function (id) {
|
|
109
|
+
setState(function (prev) {
|
|
110
|
+
return prev.filter(function (addedAttribute) {
|
|
111
|
+
return addedAttribute.id !== id && !addedAttribute.id.startsWith("".concat(id).concat(ADDED_ID_SEPARATOR));
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}, []);
|
|
115
|
+
var updateAddedAttributeRefEntity = useCallback(function (id, refEntity) {
|
|
116
|
+
setState(function (prev) { return prev.map(function (attr) { return (attr.id === id ? __assign(__assign({}, attr), { refEntity: refEntity }) : attr); }); });
|
|
117
|
+
}, []);
|
|
118
|
+
var value = useMemo(function () { return ({
|
|
119
|
+
getAddedAttributes: getAddedAttributes,
|
|
120
|
+
addAddedAttributes: addAddedAttributes,
|
|
121
|
+
removeAddedAttribute: removeAddedAttribute,
|
|
122
|
+
updateAddedAttributeRefEntity: updateAddedAttributeRefEntity
|
|
123
|
+
}); }, [getAddedAttributes, addAddedAttributes, removeAddedAttribute, updateAddedAttributeRefEntity]);
|
|
124
|
+
return React.createElement(AddedAttributesContext.Provider, { value: value }, children);
|
|
125
|
+
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AttributeError } from '@reltio/mdm-sdk';
|
|
3
|
-
import { LineData, LineDataValue } from '../../types';
|
|
2
|
+
import type { AttributeError } from '@reltio/mdm-sdk';
|
|
3
|
+
import type { LineData, LineDataValue } from '../../types';
|
|
4
4
|
export type ChangeRequestEditorContextType = {
|
|
5
5
|
updateChange: (lineIds: string[], data: LineDataValue) => void;
|
|
6
6
|
getLineData: (lineId: string) => LineData | undefined;
|
|
7
7
|
getLinesByChangeId: (changeId: string) => Array<[string, LineData]>;
|
|
8
8
|
rejectChange: (lineIds: string[]) => void;
|
|
9
9
|
revertChangeUpdateOrReject: (lineIds: string[]) => void;
|
|
10
|
+
deleteLineData: (lineIds: string[]) => void;
|
|
10
11
|
getIsParentLineRejected: (lineId: string) => boolean;
|
|
11
12
|
getIsLineRejected: (lineId: string) => boolean;
|
|
12
13
|
getIsLineUpdated: (lineId: string) => boolean;
|
|
@@ -7,6 +7,7 @@ export var ChangeRequestEditorContext = createContext({
|
|
|
7
7
|
getLinesByChangeId: undefined,
|
|
8
8
|
rejectChange: undefined,
|
|
9
9
|
revertChangeUpdateOrReject: undefined,
|
|
10
|
+
deleteLineData: undefined,
|
|
10
11
|
getIsParentLineRejected: undefined,
|
|
11
12
|
getIsLineRejected: undefined,
|
|
12
13
|
getIsLineUpdated: undefined,
|
|
@@ -16,6 +17,17 @@ export var ChangeRequestEditorContext = createContext({
|
|
|
16
17
|
getErrors: undefined
|
|
17
18
|
});
|
|
18
19
|
var emptyArray = [];
|
|
20
|
+
var removeLineDataFromMap = function (map, lineIds) {
|
|
21
|
+
var newMap = new Map(map);
|
|
22
|
+
lineIds.forEach(function (id) {
|
|
23
|
+
newMap.forEach(function (_, key) {
|
|
24
|
+
if (key.startsWith("".concat(id, "/")) || key === id) {
|
|
25
|
+
newMap.delete(key);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
return newMap;
|
|
30
|
+
};
|
|
19
31
|
export var ChangeRequestEditorProvider = function (_a) {
|
|
20
32
|
var children = _a.children;
|
|
21
33
|
var _b = useState(new Map()), lineDataMap = _b[0], setLineDataMap = _b[1];
|
|
@@ -40,15 +52,42 @@ export var ChangeRequestEditorProvider = function (_a) {
|
|
|
40
52
|
});
|
|
41
53
|
}, []);
|
|
42
54
|
var revertChangeUpdateOrReject = useCallback(function (lineIds) {
|
|
55
|
+
setLineDataMap(function (prevMap) { return removeLineDataFromMap(prevMap, lineIds); });
|
|
56
|
+
}, []);
|
|
57
|
+
var deleteLineData = useCallback(function (lineIds) {
|
|
43
58
|
setLineDataMap(function (prevMap) {
|
|
44
|
-
var newMap =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
59
|
+
var newMap = removeLineDataFromMap(prevMap, lineIds);
|
|
60
|
+
var _loop_1 = function (lineId) {
|
|
61
|
+
var parts = lineId.split('/');
|
|
62
|
+
var deletedIndex = parseInt(parts[parts.length - 1]);
|
|
63
|
+
if (isNaN(deletedIndex))
|
|
64
|
+
return "continue";
|
|
65
|
+
var prefix = parts.slice(0, -1).join('/') + '/';
|
|
66
|
+
var toRename = [];
|
|
67
|
+
newMap.forEach(function (data, key) {
|
|
68
|
+
if (!key.startsWith(prefix))
|
|
69
|
+
return;
|
|
70
|
+
var rest = key.slice(prefix.length);
|
|
71
|
+
var indexStr = rest.split('/')[0];
|
|
72
|
+
var index = parseInt(indexStr);
|
|
73
|
+
if (isNaN(index) || index <= deletedIndex)
|
|
74
|
+
return;
|
|
75
|
+
var newKey = prefix + String(index - 1) + rest.slice(indexStr.length);
|
|
76
|
+
toRename.push({ oldKey: key, newKey: newKey, data: data });
|
|
50
77
|
});
|
|
51
|
-
|
|
78
|
+
for (var _a = 0, toRename_1 = toRename; _a < toRename_1.length; _a++) {
|
|
79
|
+
var oldKey = toRename_1[_a].oldKey;
|
|
80
|
+
newMap.delete(oldKey);
|
|
81
|
+
}
|
|
82
|
+
for (var _b = 0, toRename_2 = toRename; _b < toRename_2.length; _b++) {
|
|
83
|
+
var _c = toRename_2[_b], newKey = _c.newKey, data = _c.data;
|
|
84
|
+
newMap.set(newKey, data);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
for (var _i = 0, lineIds_1 = lineIds; _i < lineIds_1.length; _i++) {
|
|
88
|
+
var lineId = lineIds_1[_i];
|
|
89
|
+
_loop_1(lineId);
|
|
90
|
+
}
|
|
52
91
|
return newMap;
|
|
53
92
|
});
|
|
54
93
|
}, []);
|
|
@@ -101,6 +140,7 @@ export var ChangeRequestEditorProvider = function (_a) {
|
|
|
101
140
|
getLinesByChangeId: getLinesByChangeId,
|
|
102
141
|
rejectChange: rejectChange,
|
|
103
142
|
revertChangeUpdateOrReject: revertChangeUpdateOrReject,
|
|
143
|
+
deleteLineData: deleteLineData,
|
|
104
144
|
getIsParentLineRejected: getIsParentLineRejected,
|
|
105
145
|
getIsLineRejected: getIsLineRejected,
|
|
106
146
|
getIsLineUpdated: getIsLineUpdated,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type ScrollToAddedAttributeContextType = {
|
|
3
|
+
highlightedIds: Set<string>;
|
|
4
|
+
highlight: (addedIds: string[]) => void;
|
|
5
|
+
scrollToFirst: (ref: React.RefObject<HTMLDivElement>) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const ScrollToAddedAttributeContext: React.Context<ScrollToAddedAttributeContextType>;
|
|
8
|
+
export declare const ScrollToAddedAttributeProvider: ({ children }: {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}) => React.JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
var EMPTY_SET = new Set();
|
|
3
|
+
var HIGHLIGHT_DURATION_MS = 2000;
|
|
4
|
+
export var ScrollToAddedAttributeContext = React.createContext({
|
|
5
|
+
highlightedIds: EMPTY_SET,
|
|
6
|
+
highlight: function () { },
|
|
7
|
+
scrollToFirst: function () { }
|
|
8
|
+
});
|
|
9
|
+
export var ScrollToAddedAttributeProvider = function (_a) {
|
|
10
|
+
var children = _a.children;
|
|
11
|
+
var _b = useState(EMPTY_SET), highlightedIds = _b[0], setHighlightedIds = _b[1];
|
|
12
|
+
var highlightTimer = useRef(null);
|
|
13
|
+
var highlightDelay = useRef(null);
|
|
14
|
+
var bestScrollTarget = useRef(null);
|
|
15
|
+
var scrollRafId = useRef(0);
|
|
16
|
+
var highlight = useCallback(function (addedIds) {
|
|
17
|
+
if (addedIds.length === 0)
|
|
18
|
+
return;
|
|
19
|
+
bestScrollTarget.current = null;
|
|
20
|
+
clearTimeout(highlightTimer.current);
|
|
21
|
+
clearTimeout(highlightDelay.current);
|
|
22
|
+
highlightDelay.current = setTimeout(function () {
|
|
23
|
+
setHighlightedIds(new Set(addedIds));
|
|
24
|
+
highlightTimer.current = setTimeout(function () { return setHighlightedIds(EMPTY_SET); }, HIGHLIGHT_DURATION_MS);
|
|
25
|
+
}, 300);
|
|
26
|
+
}, []);
|
|
27
|
+
var scrollToFirst = useCallback(function (ref) {
|
|
28
|
+
if (!ref.current)
|
|
29
|
+
return;
|
|
30
|
+
var el = ref.current;
|
|
31
|
+
if (!bestScrollTarget.current ||
|
|
32
|
+
el.getBoundingClientRect().top < bestScrollTarget.current.getBoundingClientRect().top) {
|
|
33
|
+
bestScrollTarget.current = el;
|
|
34
|
+
}
|
|
35
|
+
cancelAnimationFrame(scrollRafId.current);
|
|
36
|
+
scrollRafId.current = requestAnimationFrame(function () {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
(_b = (_a = bestScrollTarget.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a, { behavior: 'smooth', block: 'center' });
|
|
39
|
+
bestScrollTarget.current = null;
|
|
40
|
+
});
|
|
41
|
+
}, []);
|
|
42
|
+
useEffect(function () {
|
|
43
|
+
return function () {
|
|
44
|
+
clearTimeout(highlightTimer.current);
|
|
45
|
+
clearTimeout(highlightDelay.current);
|
|
46
|
+
cancelAnimationFrame(scrollRafId.current);
|
|
47
|
+
};
|
|
48
|
+
}, []);
|
|
49
|
+
var value = useMemo(function () { return ({ highlightedIds: highlightedIds, highlight: highlight, scrollToFirst: scrollToFirst }); }, [highlightedIds, highlight, scrollToFirst]);
|
|
50
|
+
return React.createElement(ScrollToAddedAttributeContext.Provider, { value: value }, children);
|
|
51
|
+
};
|
|
@@ -14,6 +14,8 @@ import { DataTypes, DCRTypes, getAttributeTypeSubAttributes, getLabel, getRelati
|
|
|
14
14
|
import { getFilteredAttrTypes } from '../../../helpers/attributesView';
|
|
15
15
|
import { getOperationType } from './common';
|
|
16
16
|
var getValues = function (attributes, attrType) {
|
|
17
|
+
if (!attributes || typeof attributes !== 'object')
|
|
18
|
+
return [];
|
|
17
19
|
if ('newValue' in attributes || 'oldValue' in attributes) {
|
|
18
20
|
var newValue = attributes.newValue, oldValue = attributes.oldValue, type_1 = attributes.type;
|
|
19
21
|
var newAttrValues_1 = pathOr([], ['value', attrType.name])(newValue);
|
|
@@ -62,16 +64,23 @@ var dcrAttributesFactory = function (metadata, attributeType, attributeValue, le
|
|
|
62
64
|
}
|
|
63
65
|
};
|
|
64
66
|
var extractLineIds = function (attributeValue) {
|
|
65
|
-
var _a
|
|
66
|
-
var
|
|
67
|
+
var _a;
|
|
68
|
+
var innerChange = attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.value;
|
|
69
|
+
var lineIds = (_a = innerChange === null || innerChange === void 0 ? void 0 : innerChange.newValue) === null || _a === void 0 ? void 0 : _a.lineIds;
|
|
67
70
|
return Array.isArray(lineIds) ? lineIds : attributeValue.lineIds;
|
|
68
71
|
};
|
|
72
|
+
var extractAddedId = function (attributeValue) {
|
|
73
|
+
var _a, _b, _c, _d;
|
|
74
|
+
var innerChange = attributeValue.value;
|
|
75
|
+
return ((_d = (_b = (_a = innerChange === null || innerChange === void 0 ? void 0 : innerChange.newValue) === null || _a === void 0 ? void 0 : _a.addedId) !== null && _b !== void 0 ? _b : (_c = attributeValue.newValue) === null || _c === void 0 ? void 0 : _c.addedId) !== null && _d !== void 0 ? _d : attributeValue.addedId);
|
|
76
|
+
};
|
|
69
77
|
var getNestedAttributeChange = function (metadata, attributeType, attributeValue, level) {
|
|
70
78
|
var attributeTypeList = getAttributeTypeSubAttributes({}, attributeType);
|
|
71
79
|
var label = getLabel((attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name));
|
|
72
80
|
var lineIds = extractLineIds(attributeValue);
|
|
81
|
+
var addedId = extractAddedId(attributeValue);
|
|
73
82
|
return [
|
|
74
|
-
{ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds },
|
|
83
|
+
__assign({ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds }, (addedId && { addedId: addedId })),
|
|
75
84
|
getAttributesList(metadata, attributeTypeList, attributeValue.value, level + 1)
|
|
76
85
|
];
|
|
77
86
|
};
|
|
@@ -79,8 +88,9 @@ var getReferenceAttributeChange = function (metadata, attributeType, attributeVa
|
|
|
79
88
|
var attributeTypeList = getAttributeTypeSubAttributes(metadata, attributeType);
|
|
80
89
|
var label = (attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name);
|
|
81
90
|
var lineIds = extractLineIds(attributeValue);
|
|
91
|
+
var addedId = extractAddedId(attributeValue);
|
|
82
92
|
return [
|
|
83
|
-
{ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds },
|
|
93
|
+
__assign({ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds }, (addedId && { addedId: addedId })),
|
|
84
94
|
getAttributesList(metadata, attributeTypeList, attributeValue.value, level + 1, true)
|
|
85
95
|
];
|
|
86
96
|
};
|
|
@@ -94,16 +104,9 @@ var getSimpleAttributeChange = function (attributeType, attributeValue, level, i
|
|
|
94
104
|
if (isReferenceSubAttribute === void 0) { isReferenceSubAttribute = false; }
|
|
95
105
|
var _a = getDiffParameters(attributeValue), newValue = _a.newValue, oldValue = _a.oldValue, type = _a.type, newPinOrIgnoreValue = _a.newPinOrIgnoreValue;
|
|
96
106
|
var operation = getOperationType(type, newPinOrIgnoreValue);
|
|
107
|
+
var addedId = extractAddedId(attributeValue);
|
|
97
108
|
var label = (attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name);
|
|
98
|
-
return {
|
|
99
|
-
attributeType: attributeType,
|
|
100
|
-
newValue: newValue,
|
|
101
|
-
oldValue: oldValue,
|
|
102
|
-
operation: operation,
|
|
103
|
-
label: label,
|
|
104
|
-
level: level,
|
|
105
|
-
isReferenceSubAttribute: isReferenceSubAttribute
|
|
106
|
-
};
|
|
109
|
+
return __assign(__assign(__assign(__assign({ attributeType: attributeType, newValue: newValue, oldValue: oldValue, operation: operation, label: label, level: level, isReferenceSubAttribute: isReferenceSubAttribute }, (addedId && { addedId: addedId })), (attributeValue.attributePath && { attributePath: attributeValue.attributePath })), (attributeValue.refAttributeType && { refAttributeType: attributeValue.refAttributeType })), (attributeValue.refObjectURI && { refObjectURI: attributeValue.refObjectURI }));
|
|
107
110
|
};
|
|
108
111
|
export var getEntityChanges = curry(function (metadata, entityInfo, changes) {
|
|
109
112
|
var attrTypes = getFilteredAttrTypes(metadata, entityInfo.type, [], []);
|
|
@@ -94,7 +94,8 @@ describe('attributes helpers tests', function () {
|
|
|
94
94
|
level: 0,
|
|
95
95
|
newValue: __assign(__assign({}, changes.CountryCode[0].value.newValue), { lineIds: ['3AqlrpfGa/value/oldValue'] }),
|
|
96
96
|
operation: 'ignored',
|
|
97
|
-
isReferenceSubAttribute: false
|
|
97
|
+
isReferenceSubAttribute: false,
|
|
98
|
+
attributePath: 'CountryCode/3AqlrpfGa'
|
|
98
99
|
},
|
|
99
100
|
{
|
|
100
101
|
attributeType: metadata.entityTypes[0].attributes[1],
|
|
@@ -102,7 +103,8 @@ describe('attributes helpers tests', function () {
|
|
|
102
103
|
level: 0,
|
|
103
104
|
newValue: changes.CountryCode[1].value.newValue,
|
|
104
105
|
operation: 'added',
|
|
105
|
-
isReferenceSubAttribute: false
|
|
106
|
+
isReferenceSubAttribute: false,
|
|
107
|
+
attributePath: 'CountryCode'
|
|
106
108
|
},
|
|
107
109
|
{
|
|
108
110
|
attributeType: metadata.entityTypes[0].attributes[3],
|
|
@@ -116,7 +118,8 @@ describe('attributes helpers tests', function () {
|
|
|
116
118
|
level: 1,
|
|
117
119
|
newValue: changes.Identifiers[0].value.Type[0].value.newValue,
|
|
118
120
|
operation: 'ignored',
|
|
119
|
-
isReferenceSubAttribute: false
|
|
121
|
+
isReferenceSubAttribute: false,
|
|
122
|
+
attributePath: 'Identifiers/45uypcuAz/Type/45uypcyRF'
|
|
120
123
|
}
|
|
121
124
|
]);
|
|
122
125
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AttributeDelete, ChangeRequest, DCRChange, DCRChanges, DCRObjectInfo, DCRObjectsInfo, GroupedObjectsInfo, Metadata } from '@reltio/mdm-sdk';
|
|
1
|
+
import { AttributeDelete, AttributeInsert, ChangeRequest, DCRChange, DCRChanges, DCRObjectInfo, DCRObjectsInfo, EndDateUpdate, Entity, GroupedObjectsInfo, Metadata, RolesUpdate, StartDateUpdate, TagsUpdate } from '@reltio/mdm-sdk';
|
|
2
2
|
import { LineData } from '../types';
|
|
3
|
+
type CumulativeUpdateDiffEntry = AttributeInsert | EndDateUpdate | StartDateUpdate | TagsUpdate | RolesUpdate;
|
|
3
4
|
export declare const getEntitiesObjects: any;
|
|
4
5
|
export declare const getRelationsObjects: any;
|
|
5
6
|
export declare const extractObjectsFromChangeRequest: (changes: DCRChanges, objectsInfo: DCRObjectsInfo) => DCRObjectInfo[];
|
|
@@ -13,4 +14,8 @@ export declare const buildDCRSavePlan: (changes: DCRChanges, getLinesByChangeId:
|
|
|
13
14
|
updatedChanges: Record<string, DCRChange[]>;
|
|
14
15
|
deleteEntityAttributes: Record<string, AttributeDelete[]>;
|
|
15
16
|
deleteRelationAttributes: Record<string, AttributeDelete[]>;
|
|
17
|
+
insertEntityAttributes: Record<string, CumulativeUpdateDiffEntry[]>;
|
|
18
|
+
insertRelationAttributes: Record<string, CumulativeUpdateDiffEntry[]>;
|
|
16
19
|
};
|
|
20
|
+
export declare const mergeExistingRolesAndTags: (diff: CumulativeUpdateDiffEntry[], entity: Entity) => CumulativeUpdateDiffEntry[];
|
|
21
|
+
export {};
|