@reltio/components 1.4.2243 → 1.4.2245
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 +31 -9
- 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 +123 -19
- package/cjs/features/workflow/helpers/dcr.test.js +171 -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 +32 -10
- 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 +122 -19
- package/features/workflow/helpers/dcr.test.js +172 -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 {};
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useChangeRequestEditor = void 0;
|
|
4
4
|
var react_1 = require("react");
|
|
5
|
+
var ramda_1 = require("ramda");
|
|
5
6
|
var react_context_selector_1 = require("@fluentui/react-context-selector");
|
|
6
7
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
7
8
|
var ChangeRequestEditorContext_1 = require("../../contexts/ChangeRequestEditorContext");
|
|
8
9
|
var merge_1 = require("../../helpers/merge");
|
|
10
|
+
var helpers_1 = require("../helpers/helpers");
|
|
9
11
|
var emptyLineIds = [];
|
|
10
12
|
var useChangeRequestEditor = function (_a) {
|
|
11
13
|
var change = _a.change;
|
|
@@ -25,7 +27,7 @@ var useChangeRequestEditor = function (_a) {
|
|
|
25
27
|
lineIds.length > 0 &&
|
|
26
28
|
lineIds[0].includes('/value/');
|
|
27
29
|
var handleChange = (0, react_1.useCallback)(function (newValue) {
|
|
28
|
-
updateChange(lineIds,
|
|
30
|
+
updateChange(lineIds, (0, helpers_1.isSimpleAttributeValue)(newValue) ? newValue : { value: newValue });
|
|
29
31
|
}, [lineIds, updateChange]);
|
|
30
32
|
var handleReject = (0, react_1.useCallback)(function () {
|
|
31
33
|
rejectChange(lineIds);
|
|
@@ -33,10 +35,16 @@ var useChangeRequestEditor = function (_a) {
|
|
|
33
35
|
var handleRevert = (0, react_1.useCallback)(function () {
|
|
34
36
|
revertChangeUpdateOrReject(lineIds);
|
|
35
37
|
}, [revertChangeUpdateOrReject, lineIds]);
|
|
38
|
+
var handleImageUpload = (0, react_1.useCallback)(function (value) {
|
|
39
|
+
if ((0, ramda_1.isEmpty)(lineIds))
|
|
40
|
+
return;
|
|
41
|
+
updateChange(lineIds, value);
|
|
42
|
+
}, [lineIds, updateChange]);
|
|
36
43
|
return {
|
|
37
44
|
handleChange: handleChange,
|
|
38
45
|
handleReject: handleReject,
|
|
39
46
|
handleRevert: handleRevert,
|
|
47
|
+
handleImageUpload: handleImageUpload,
|
|
40
48
|
lineData: lineData,
|
|
41
49
|
isLineRejected: isLineRejected,
|
|
42
50
|
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,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useNewAttributesEditor = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var react_context_selector_1 = require("@fluentui/react-context-selector");
|
|
6
|
+
var ChangeRequestEditorContext_1 = require("../../contexts/ChangeRequestEditorContext");
|
|
7
|
+
var merge_1 = require("../../helpers/merge");
|
|
8
|
+
var helpers_1 = require("../helpers/helpers");
|
|
9
|
+
var addedAttributes_1 = require("../helpers/addedAttributes");
|
|
10
|
+
var AddedAttributesContext_1 = require("../../contexts/AddedAttributesContext");
|
|
11
|
+
var emptyLineIds = [];
|
|
12
|
+
var useNewAttributesEditor = function (_a) {
|
|
13
|
+
var change = _a.change;
|
|
14
|
+
var addedId = (0, addedAttributes_1.getAddedId)(change);
|
|
15
|
+
var hasAddedParent = (0, addedAttributes_1.hasParentAddedAttribute)(addedId);
|
|
16
|
+
var lineIds = change.lineIds || (0, merge_1.extractLineIds)(change === null || change === void 0 ? void 0 : change.newValue) || emptyLineIds;
|
|
17
|
+
var lineData = (0, react_context_selector_1.useContextSelector)(ChangeRequestEditorContext_1.ChangeRequestEditorContext, function (context) { return context.getLineData(lineIds[0]); });
|
|
18
|
+
var updateChange = (0, react_context_selector_1.useContextSelector)(ChangeRequestEditorContext_1.ChangeRequestEditorContext, function (context) { return context.updateChange; });
|
|
19
|
+
var isLineRejected = (0, react_context_selector_1.useContextSelector)(ChangeRequestEditorContext_1.ChangeRequestEditorContext, function (context) {
|
|
20
|
+
return context.getIsLineRejected(lineIds[0]);
|
|
21
|
+
});
|
|
22
|
+
var isParentLineRejected = (0, react_context_selector_1.useContextSelector)(ChangeRequestEditorContext_1.ChangeRequestEditorContext, function (context) {
|
|
23
|
+
return context.getIsParentLineRejected(lineIds[0]);
|
|
24
|
+
});
|
|
25
|
+
var isRejected = isLineRejected || isParentLineRejected;
|
|
26
|
+
var deleteLineData = (0, react_context_selector_1.useContextSelector)(ChangeRequestEditorContext_1.ChangeRequestEditorContext, function (ctx) { return ctx.deleteLineData; });
|
|
27
|
+
var removeAddedAttribute = (0, react_context_selector_1.useContextSelector)(AddedAttributesContext_1.AddedAttributesContext, function (ctx) { return ctx.removeAddedAttribute; });
|
|
28
|
+
var updateAddedAttributeRefEntity = (0, react_context_selector_1.useContextSelector)(AddedAttributesContext_1.AddedAttributesContext, function (ctx) { return ctx.updateAddedAttributeRefEntity; });
|
|
29
|
+
var selectedEntity = (0, react_context_selector_1.useContextSelector)(AddedAttributesContext_1.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; });
|
|
30
|
+
var handleChange = (0, react_1.useCallback)(function (newValue) {
|
|
31
|
+
updateChange(lineIds, (0, helpers_1.isSimpleAttributeValue)(newValue) ? newValue : { value: newValue });
|
|
32
|
+
}, [lineIds, updateChange]);
|
|
33
|
+
var handleDelete = (0, react_1.useCallback)(function () {
|
|
34
|
+
if (!addedId)
|
|
35
|
+
return;
|
|
36
|
+
removeAddedAttribute(addedId);
|
|
37
|
+
deleteLineData(lineIds);
|
|
38
|
+
}, [addedId, deleteLineData, lineIds, removeAddedAttribute]);
|
|
39
|
+
var handleEntityChange = (0, react_1.useCallback)(function (entity) {
|
|
40
|
+
if (!addedId)
|
|
41
|
+
return;
|
|
42
|
+
updateAddedAttributeRefEntity(addedId, {
|
|
43
|
+
entityUri: entity.uri,
|
|
44
|
+
entityType: entity.type,
|
|
45
|
+
entityLabel: entity.label
|
|
46
|
+
});
|
|
47
|
+
}, [addedId, updateAddedAttributeRefEntity]);
|
|
48
|
+
var handleImageUpload = (0, react_1.useCallback)(function (value) {
|
|
49
|
+
if (lineIds.length === 0)
|
|
50
|
+
return;
|
|
51
|
+
updateChange(lineIds, value);
|
|
52
|
+
}, [lineIds, updateChange]);
|
|
53
|
+
return {
|
|
54
|
+
lineData: lineData,
|
|
55
|
+
addedId: addedId,
|
|
56
|
+
selectedEntity: selectedEntity,
|
|
57
|
+
isRejected: isRejected,
|
|
58
|
+
hasAddedParent: hasAddedParent,
|
|
59
|
+
handleDelete: handleDelete,
|
|
60
|
+
handleChange: handleChange,
|
|
61
|
+
handleEntityChange: handleEntityChange,
|
|
62
|
+
handleImageUpload: handleImageUpload
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
exports.useNewAttributesEditor = useNewAttributesEditor;
|
|
@@ -39,7 +39,9 @@ var useChangeRequest_1 = require("../../../hooks/useChangeRequest");
|
|
|
39
39
|
var common_1 = require("../../../helpers/common");
|
|
40
40
|
var ReviewDCRDialog_1 = require("../../../ReviewDCRDialog");
|
|
41
41
|
var ReviewDCRButton_1 = require("../../../ReviewDCRButton");
|
|
42
|
+
var AddedAttributesContext_1 = require("../../../contexts/AddedAttributesContext");
|
|
42
43
|
var ChangeRequestEditorContext_1 = require("../../../contexts/ChangeRequestEditorContext");
|
|
44
|
+
var ScrollToAddedAttributeContext_1 = require("../../../contexts/ScrollToAddedAttributeContext");
|
|
43
45
|
var WorkflowTasksContext_1 = require("../../../../../contexts/WorkflowTasksContext");
|
|
44
46
|
var ScrollToElementContext_1 = require("../../../../../contexts/ScrollToElementContext");
|
|
45
47
|
var DataChangeRequestTaskCard = function (_a) {
|
|
@@ -67,8 +69,10 @@ var DataChangeRequestTaskCard = function (_a) {
|
|
|
67
69
|
react_1.default.createElement(GenericWorkflowTaskCard_1.GenericWorkflowTaskCard, { task: task, Icon: DcrTaskIcon_1.default, customActionsSlot: customActionsSlot }, dcr &&
|
|
68
70
|
groupedObjects.map(function (object, index) { return (react_1.default.createElement(LineDecorator_1.LineDecorator, { key: index, last: index === groupedObjects.length - 1, divider: true },
|
|
69
71
|
react_1.default.createElement(AttributesChanges_1.AttributesChanges, { entityInfo: object.entity, relationsInfo: object.relations, changes: dcr.changes, objectsInfo: dcr.objectsInfo, dcrUri: dcrUri }))); })),
|
|
70
|
-
showReviewDialog && (react_1.default.createElement(
|
|
71
|
-
react_1.default.createElement(
|
|
72
|
-
react_1.default.createElement(
|
|
72
|
+
showReviewDialog && (react_1.default.createElement(AddedAttributesContext_1.AddedAttributesProvider, null,
|
|
73
|
+
react_1.default.createElement(ChangeRequestEditorContext_1.ChangeRequestEditorProvider, null,
|
|
74
|
+
react_1.default.createElement(ScrollToElementContext_1.ScrollToElementProvider, null,
|
|
75
|
+
react_1.default.createElement(ScrollToAddedAttributeContext_1.ScrollToAddedAttributeProvider, null,
|
|
76
|
+
react_1.default.createElement(ReviewDCRDialog_1.ReviewDCRDialog, { open: isReviewDCRDialogOpen, onClose: handleCloseReviewDCRDialog, dcr: dcr, groupedObjects: groupedObjects, task: task }))))))));
|
|
73
77
|
};
|
|
74
78
|
exports.DataChangeRequestTaskCard = DataChangeRequestTaskCard;
|
|
@@ -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,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
37
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
38
|
+
if (ar || !(i in from)) {
|
|
39
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
40
|
+
ar[i] = from[i];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.AddedAttributesProvider = exports.AddedAttributesContext = exports.ADDED_CHANGE_ID_PREFIX = exports.ADDED_ID_SEPARATOR = void 0;
|
|
47
|
+
var react_1 = __importStar(require("react"));
|
|
48
|
+
var react_context_selector_1 = require("@fluentui/react-context-selector");
|
|
49
|
+
var nanoid_1 = require("nanoid");
|
|
50
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
51
|
+
var MdmModuleContext_1 = require("../../../../contexts/MdmModuleContext");
|
|
52
|
+
var moreAttributesScope_1 = require("../../helpers/moreAttributesScope");
|
|
53
|
+
exports.ADDED_ID_SEPARATOR = '|';
|
|
54
|
+
exports.ADDED_CHANGE_ID_PREFIX = "added".concat(exports.ADDED_ID_SEPARATOR);
|
|
55
|
+
exports.AddedAttributesContext = (0, react_context_selector_1.createContext)({
|
|
56
|
+
getAddedAttributes: undefined,
|
|
57
|
+
addAddedAttributes: undefined,
|
|
58
|
+
removeAddedAttribute: undefined,
|
|
59
|
+
updateAddedAttributeRefEntity: undefined
|
|
60
|
+
});
|
|
61
|
+
var getInitialAttributeValue = function (attrType) {
|
|
62
|
+
if ((0, mdm_sdk_1.isComplexAttribute)(attrType) || (0, mdm_sdk_1.isImage)(attrType))
|
|
63
|
+
return undefined;
|
|
64
|
+
var _a = (0, mdm_sdk_1.createNewAttributeValue)(attrType), value = _a.value, lookupCode = _a.lookupCode;
|
|
65
|
+
if (value === '' && !lookupCode)
|
|
66
|
+
return undefined;
|
|
67
|
+
return lookupCode ? { value: value, lookupCode: lookupCode } : { value: value };
|
|
68
|
+
};
|
|
69
|
+
var generateAddedAttributeId = function (parentId) {
|
|
70
|
+
return parentId ? "".concat(parentId).concat(exports.ADDED_ID_SEPARATOR).concat((0, nanoid_1.nanoid)()) : "".concat(exports.ADDED_CHANGE_ID_PREFIX).concat((0, nanoid_1.nanoid)());
|
|
71
|
+
};
|
|
72
|
+
var createAddedAttribute = function (_a) {
|
|
73
|
+
var attributeType = _a.attributeType, objectUri = _a.objectUri, parentLineId = _a.parentLineId, parentId = _a.parentId, changeOverrides = _a.changeOverrides;
|
|
74
|
+
var finalChangeOverrides = changeOverrides
|
|
75
|
+
? __assign(__assign(__assign({}, changeOverrides), (changeOverrides.attributePath && {
|
|
76
|
+
attributePath: "".concat(changeOverrides.attributePath, "/").concat(attributeType.name)
|
|
77
|
+
})), (changeOverrides.refAttributeType && {
|
|
78
|
+
refAttributeType: "".concat(changeOverrides.refAttributeType, "/attributes/").concat(attributeType.name)
|
|
79
|
+
})) : undefined;
|
|
80
|
+
var initialValue = getInitialAttributeValue(attributeType);
|
|
81
|
+
return __assign({ attributeType: attributeType, id: generateAddedAttributeId(parentId), objectUri: objectUri, parentLineId: parentLineId, parentId: parentId, changeOverrides: finalChangeOverrides }, (initialValue && { initialValue: initialValue }));
|
|
82
|
+
};
|
|
83
|
+
var AddedAttributesProvider = function (_a) {
|
|
84
|
+
var children = _a.children;
|
|
85
|
+
var metadata = (0, MdmModuleContext_1.useMdmMetadata)();
|
|
86
|
+
var _b = (0, react_1.useState)([]), state = _b[0], setState = _b[1];
|
|
87
|
+
var getAddedAttributes = (0, react_1.useCallback)(function () { return state; }, [state]);
|
|
88
|
+
var createAddedAttributes = (0, react_1.useCallback)(function (_a) {
|
|
89
|
+
var attributeType = _a.attributeType, objectUri = _a.objectUri, parentLineId = _a.parentLineId, parentId = _a.parentId, changeOverrides = _a.changeOverrides;
|
|
90
|
+
var addedAttribute = createAddedAttribute({
|
|
91
|
+
attributeType: attributeType,
|
|
92
|
+
objectUri: objectUri,
|
|
93
|
+
parentLineId: parentLineId,
|
|
94
|
+
parentId: parentId,
|
|
95
|
+
changeOverrides: changeOverrides
|
|
96
|
+
});
|
|
97
|
+
var result = [addedAttribute];
|
|
98
|
+
if ((0, mdm_sdk_1.isComplexAttribute)(attributeType)) {
|
|
99
|
+
var subAttributes = (0, moreAttributesScope_1.getAvailableSubAttributesForNestedOrReference)(metadata, attributeType);
|
|
100
|
+
for (var _i = 0, subAttributes_1 = subAttributes; _i < subAttributes_1.length; _i++) {
|
|
101
|
+
var attr = subAttributes_1[_i];
|
|
102
|
+
if (attr.required) {
|
|
103
|
+
result.push.apply(result, createAddedAttributes({
|
|
104
|
+
attributeType: attr,
|
|
105
|
+
objectUri: objectUri,
|
|
106
|
+
parentId: addedAttribute.id
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
result.push(createAddedAttribute({
|
|
111
|
+
attributeType: attr,
|
|
112
|
+
objectUri: objectUri,
|
|
113
|
+
parentId: addedAttribute.id
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return result;
|
|
119
|
+
}, [metadata]);
|
|
120
|
+
var addAddedAttributes = (0, react_1.useCallback)(function (_a) {
|
|
121
|
+
var attributeTypes = _a.attributeTypes, objectUri = _a.objectUri, parentLineId = _a.parentLineId, parentId = _a.parentId, changeOverrides = _a.changeOverrides;
|
|
122
|
+
if (attributeTypes.length === 0)
|
|
123
|
+
return [];
|
|
124
|
+
var addedIds = [];
|
|
125
|
+
setState(function (prev) {
|
|
126
|
+
var newAddedAttributes = attributeTypes.flatMap(function (attributeType) {
|
|
127
|
+
return createAddedAttributes({ attributeType: attributeType, objectUri: objectUri, parentLineId: parentLineId, parentId: parentId, changeOverrides: changeOverrides });
|
|
128
|
+
});
|
|
129
|
+
addedIds.push.apply(addedIds, newAddedAttributes.map(function (attr) { return attr.id; }));
|
|
130
|
+
return __spreadArray(__spreadArray([], prev, true), newAddedAttributes, true);
|
|
131
|
+
});
|
|
132
|
+
return addedIds;
|
|
133
|
+
}, [createAddedAttributes]);
|
|
134
|
+
var removeAddedAttribute = (0, react_1.useCallback)(function (id) {
|
|
135
|
+
setState(function (prev) {
|
|
136
|
+
return prev.filter(function (addedAttribute) {
|
|
137
|
+
return addedAttribute.id !== id && !addedAttribute.id.startsWith("".concat(id).concat(exports.ADDED_ID_SEPARATOR));
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}, []);
|
|
141
|
+
var updateAddedAttributeRefEntity = (0, react_1.useCallback)(function (id, refEntity) {
|
|
142
|
+
setState(function (prev) { return prev.map(function (attr) { return (attr.id === id ? __assign(__assign({}, attr), { refEntity: refEntity }) : attr); }); });
|
|
143
|
+
}, []);
|
|
144
|
+
var value = (0, react_1.useMemo)(function () { return ({
|
|
145
|
+
getAddedAttributes: getAddedAttributes,
|
|
146
|
+
addAddedAttributes: addAddedAttributes,
|
|
147
|
+
removeAddedAttribute: removeAddedAttribute,
|
|
148
|
+
updateAddedAttributeRefEntity: updateAddedAttributeRefEntity
|
|
149
|
+
}); }, [getAddedAttributes, addAddedAttributes, removeAddedAttribute, updateAddedAttributeRefEntity]);
|
|
150
|
+
return react_1.default.createElement(exports.AddedAttributesContext.Provider, { value: value }, children);
|
|
151
|
+
};
|
|
152
|
+
exports.AddedAttributesProvider = AddedAttributesProvider;
|
|
@@ -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;
|
|
@@ -33,6 +33,7 @@ exports.ChangeRequestEditorContext = (0, react_context_selector_1.createContext)
|
|
|
33
33
|
getLinesByChangeId: undefined,
|
|
34
34
|
rejectChange: undefined,
|
|
35
35
|
revertChangeUpdateOrReject: undefined,
|
|
36
|
+
deleteLineData: undefined,
|
|
36
37
|
getIsParentLineRejected: undefined,
|
|
37
38
|
getIsLineRejected: undefined,
|
|
38
39
|
getIsLineUpdated: undefined,
|
|
@@ -42,6 +43,17 @@ exports.ChangeRequestEditorContext = (0, react_context_selector_1.createContext)
|
|
|
42
43
|
getErrors: undefined
|
|
43
44
|
});
|
|
44
45
|
var emptyArray = [];
|
|
46
|
+
var removeLineDataFromMap = function (map, lineIds) {
|
|
47
|
+
var newMap = new Map(map);
|
|
48
|
+
lineIds.forEach(function (id) {
|
|
49
|
+
newMap.forEach(function (_, key) {
|
|
50
|
+
if (key.startsWith("".concat(id, "/")) || key === id) {
|
|
51
|
+
newMap.delete(key);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
return newMap;
|
|
56
|
+
};
|
|
45
57
|
var ChangeRequestEditorProvider = function (_a) {
|
|
46
58
|
var children = _a.children;
|
|
47
59
|
var _b = (0, react_1.useState)(new Map()), lineDataMap = _b[0], setLineDataMap = _b[1];
|
|
@@ -66,15 +78,42 @@ var ChangeRequestEditorProvider = function (_a) {
|
|
|
66
78
|
});
|
|
67
79
|
}, []);
|
|
68
80
|
var revertChangeUpdateOrReject = (0, react_1.useCallback)(function (lineIds) {
|
|
81
|
+
setLineDataMap(function (prevMap) { return removeLineDataFromMap(prevMap, lineIds); });
|
|
82
|
+
}, []);
|
|
83
|
+
var deleteLineData = (0, react_1.useCallback)(function (lineIds) {
|
|
69
84
|
setLineDataMap(function (prevMap) {
|
|
70
|
-
var newMap =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
var newMap = removeLineDataFromMap(prevMap, lineIds);
|
|
86
|
+
var _loop_1 = function (lineId) {
|
|
87
|
+
var parts = lineId.split('/');
|
|
88
|
+
var deletedIndex = parseInt(parts[parts.length - 1]);
|
|
89
|
+
if (isNaN(deletedIndex))
|
|
90
|
+
return "continue";
|
|
91
|
+
var prefix = parts.slice(0, -1).join('/') + '/';
|
|
92
|
+
var toRename = [];
|
|
93
|
+
newMap.forEach(function (data, key) {
|
|
94
|
+
if (!key.startsWith(prefix))
|
|
95
|
+
return;
|
|
96
|
+
var rest = key.slice(prefix.length);
|
|
97
|
+
var indexStr = rest.split('/')[0];
|
|
98
|
+
var index = parseInt(indexStr);
|
|
99
|
+
if (isNaN(index) || index <= deletedIndex)
|
|
100
|
+
return;
|
|
101
|
+
var newKey = prefix + String(index - 1) + rest.slice(indexStr.length);
|
|
102
|
+
toRename.push({ oldKey: key, newKey: newKey, data: data });
|
|
76
103
|
});
|
|
77
|
-
|
|
104
|
+
for (var _a = 0, toRename_1 = toRename; _a < toRename_1.length; _a++) {
|
|
105
|
+
var oldKey = toRename_1[_a].oldKey;
|
|
106
|
+
newMap.delete(oldKey);
|
|
107
|
+
}
|
|
108
|
+
for (var _b = 0, toRename_2 = toRename; _b < toRename_2.length; _b++) {
|
|
109
|
+
var _c = toRename_2[_b], newKey = _c.newKey, data = _c.data;
|
|
110
|
+
newMap.set(newKey, data);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
for (var _i = 0, lineIds_1 = lineIds; _i < lineIds_1.length; _i++) {
|
|
114
|
+
var lineId = lineIds_1[_i];
|
|
115
|
+
_loop_1(lineId);
|
|
116
|
+
}
|
|
78
117
|
return newMap;
|
|
79
118
|
});
|
|
80
119
|
}, []);
|
|
@@ -127,6 +166,7 @@ var ChangeRequestEditorProvider = function (_a) {
|
|
|
127
166
|
getLinesByChangeId: getLinesByChangeId,
|
|
128
167
|
rejectChange: rejectChange,
|
|
129
168
|
revertChangeUpdateOrReject: revertChangeUpdateOrReject,
|
|
169
|
+
deleteLineData: deleteLineData,
|
|
130
170
|
getIsParentLineRejected: getIsParentLineRejected,
|
|
131
171
|
getIsLineRejected: getIsLineRejected,
|
|
132
172
|
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,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ScrollToAddedAttributeProvider = exports.ScrollToAddedAttributeContext = void 0;
|
|
27
|
+
var react_1 = __importStar(require("react"));
|
|
28
|
+
var EMPTY_SET = new Set();
|
|
29
|
+
var HIGHLIGHT_DURATION_MS = 2000;
|
|
30
|
+
exports.ScrollToAddedAttributeContext = react_1.default.createContext({
|
|
31
|
+
highlightedIds: EMPTY_SET,
|
|
32
|
+
highlight: function () { },
|
|
33
|
+
scrollToFirst: function () { }
|
|
34
|
+
});
|
|
35
|
+
var ScrollToAddedAttributeProvider = function (_a) {
|
|
36
|
+
var children = _a.children;
|
|
37
|
+
var _b = (0, react_1.useState)(EMPTY_SET), highlightedIds = _b[0], setHighlightedIds = _b[1];
|
|
38
|
+
var highlightTimer = (0, react_1.useRef)(null);
|
|
39
|
+
var highlightDelay = (0, react_1.useRef)(null);
|
|
40
|
+
var bestScrollTarget = (0, react_1.useRef)(null);
|
|
41
|
+
var scrollRafId = (0, react_1.useRef)(0);
|
|
42
|
+
var highlight = (0, react_1.useCallback)(function (addedIds) {
|
|
43
|
+
if (addedIds.length === 0)
|
|
44
|
+
return;
|
|
45
|
+
bestScrollTarget.current = null;
|
|
46
|
+
clearTimeout(highlightTimer.current);
|
|
47
|
+
clearTimeout(highlightDelay.current);
|
|
48
|
+
highlightDelay.current = setTimeout(function () {
|
|
49
|
+
setHighlightedIds(new Set(addedIds));
|
|
50
|
+
highlightTimer.current = setTimeout(function () { return setHighlightedIds(EMPTY_SET); }, HIGHLIGHT_DURATION_MS);
|
|
51
|
+
}, 300);
|
|
52
|
+
}, []);
|
|
53
|
+
var scrollToFirst = (0, react_1.useCallback)(function (ref) {
|
|
54
|
+
if (!ref.current)
|
|
55
|
+
return;
|
|
56
|
+
var el = ref.current;
|
|
57
|
+
if (!bestScrollTarget.current ||
|
|
58
|
+
el.getBoundingClientRect().top < bestScrollTarget.current.getBoundingClientRect().top) {
|
|
59
|
+
bestScrollTarget.current = el;
|
|
60
|
+
}
|
|
61
|
+
cancelAnimationFrame(scrollRafId.current);
|
|
62
|
+
scrollRafId.current = requestAnimationFrame(function () {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
(_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' });
|
|
65
|
+
bestScrollTarget.current = null;
|
|
66
|
+
});
|
|
67
|
+
}, []);
|
|
68
|
+
(0, react_1.useEffect)(function () {
|
|
69
|
+
return function () {
|
|
70
|
+
clearTimeout(highlightTimer.current);
|
|
71
|
+
clearTimeout(highlightDelay.current);
|
|
72
|
+
cancelAnimationFrame(scrollRafId.current);
|
|
73
|
+
};
|
|
74
|
+
}, []);
|
|
75
|
+
var value = (0, react_1.useMemo)(function () { return ({ highlightedIds: highlightedIds, highlight: highlight, scrollToFirst: scrollToFirst }); }, [highlightedIds, highlight, scrollToFirst]);
|
|
76
|
+
return react_1.default.createElement(exports.ScrollToAddedAttributeContext.Provider, { value: value }, children);
|
|
77
|
+
};
|
|
78
|
+
exports.ScrollToAddedAttributeProvider = ScrollToAddedAttributeProvider;
|
|
@@ -17,6 +17,8 @@ var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
|
17
17
|
var attributesView_1 = require("../../../helpers/attributesView");
|
|
18
18
|
var common_1 = require("./common");
|
|
19
19
|
var getValues = function (attributes, attrType) {
|
|
20
|
+
if (!attributes || typeof attributes !== 'object')
|
|
21
|
+
return [];
|
|
20
22
|
if ('newValue' in attributes || 'oldValue' in attributes) {
|
|
21
23
|
var newValue = attributes.newValue, oldValue = attributes.oldValue, type_1 = attributes.type;
|
|
22
24
|
var newAttrValues_1 = (0, ramda_1.pathOr)([], ['value', attrType.name])(newValue);
|
|
@@ -65,16 +67,23 @@ var dcrAttributesFactory = function (metadata, attributeType, attributeValue, le
|
|
|
65
67
|
}
|
|
66
68
|
};
|
|
67
69
|
var extractLineIds = function (attributeValue) {
|
|
68
|
-
var _a
|
|
69
|
-
var
|
|
70
|
+
var _a;
|
|
71
|
+
var innerChange = attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.value;
|
|
72
|
+
var lineIds = (_a = innerChange === null || innerChange === void 0 ? void 0 : innerChange.newValue) === null || _a === void 0 ? void 0 : _a.lineIds;
|
|
70
73
|
return Array.isArray(lineIds) ? lineIds : attributeValue.lineIds;
|
|
71
74
|
};
|
|
75
|
+
var extractAddedId = function (attributeValue) {
|
|
76
|
+
var _a, _b, _c, _d;
|
|
77
|
+
var innerChange = attributeValue.value;
|
|
78
|
+
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);
|
|
79
|
+
};
|
|
72
80
|
var getNestedAttributeChange = function (metadata, attributeType, attributeValue, level) {
|
|
73
81
|
var attributeTypeList = (0, mdm_sdk_1.getAttributeTypeSubAttributes)({}, attributeType);
|
|
74
82
|
var label = (0, mdm_sdk_1.getLabel)((attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name));
|
|
75
83
|
var lineIds = extractLineIds(attributeValue);
|
|
84
|
+
var addedId = extractAddedId(attributeValue);
|
|
76
85
|
return [
|
|
77
|
-
{ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds },
|
|
86
|
+
__assign({ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds }, (addedId && { addedId: addedId })),
|
|
78
87
|
getAttributesList(metadata, attributeTypeList, attributeValue.value, level + 1)
|
|
79
88
|
];
|
|
80
89
|
};
|
|
@@ -82,8 +91,9 @@ var getReferenceAttributeChange = function (metadata, attributeType, attributeVa
|
|
|
82
91
|
var attributeTypeList = (0, mdm_sdk_1.getAttributeTypeSubAttributes)(metadata, attributeType);
|
|
83
92
|
var label = (attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name);
|
|
84
93
|
var lineIds = extractLineIds(attributeValue);
|
|
94
|
+
var addedId = extractAddedId(attributeValue);
|
|
85
95
|
return [
|
|
86
|
-
{ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds },
|
|
96
|
+
__assign({ level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds }, (addedId && { addedId: addedId })),
|
|
87
97
|
getAttributesList(metadata, attributeTypeList, attributeValue.value, level + 1, true)
|
|
88
98
|
];
|
|
89
99
|
};
|
|
@@ -97,16 +107,9 @@ var getSimpleAttributeChange = function (attributeType, attributeValue, level, i
|
|
|
97
107
|
if (isReferenceSubAttribute === void 0) { isReferenceSubAttribute = false; }
|
|
98
108
|
var _a = getDiffParameters(attributeValue), newValue = _a.newValue, oldValue = _a.oldValue, type = _a.type, newPinOrIgnoreValue = _a.newPinOrIgnoreValue;
|
|
99
109
|
var operation = (0, common_1.getOperationType)(type, newPinOrIgnoreValue);
|
|
110
|
+
var addedId = extractAddedId(attributeValue);
|
|
100
111
|
var label = (attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name);
|
|
101
|
-
return {
|
|
102
|
-
attributeType: attributeType,
|
|
103
|
-
newValue: newValue,
|
|
104
|
-
oldValue: oldValue,
|
|
105
|
-
operation: operation,
|
|
106
|
-
label: label,
|
|
107
|
-
level: level,
|
|
108
|
-
isReferenceSubAttribute: isReferenceSubAttribute
|
|
109
|
-
};
|
|
112
|
+
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 }));
|
|
110
113
|
};
|
|
111
114
|
exports.getEntityChanges = (0, ramda_1.curry)(function (metadata, entityInfo, changes) {
|
|
112
115
|
var attrTypes = (0, attributesView_1.getFilteredAttrTypes)(metadata, entityInfo.type, [], []);
|
|
@@ -96,7 +96,8 @@ describe('attributes helpers tests', function () {
|
|
|
96
96
|
level: 0,
|
|
97
97
|
newValue: __assign(__assign({}, changes.CountryCode[0].value.newValue), { lineIds: ['3AqlrpfGa/value/oldValue'] }),
|
|
98
98
|
operation: 'ignored',
|
|
99
|
-
isReferenceSubAttribute: false
|
|
99
|
+
isReferenceSubAttribute: false,
|
|
100
|
+
attributePath: 'CountryCode/3AqlrpfGa'
|
|
100
101
|
},
|
|
101
102
|
{
|
|
102
103
|
attributeType: metadata.entityTypes[0].attributes[1],
|
|
@@ -104,7 +105,8 @@ describe('attributes helpers tests', function () {
|
|
|
104
105
|
level: 0,
|
|
105
106
|
newValue: changes.CountryCode[1].value.newValue,
|
|
106
107
|
operation: 'added',
|
|
107
|
-
isReferenceSubAttribute: false
|
|
108
|
+
isReferenceSubAttribute: false,
|
|
109
|
+
attributePath: 'CountryCode'
|
|
108
110
|
},
|
|
109
111
|
{
|
|
110
112
|
attributeType: metadata.entityTypes[0].attributes[3],
|
|
@@ -118,7 +120,8 @@ describe('attributes helpers tests', function () {
|
|
|
118
120
|
level: 1,
|
|
119
121
|
newValue: changes.Identifiers[0].value.Type[0].value.newValue,
|
|
120
122
|
operation: 'ignored',
|
|
121
|
-
isReferenceSubAttribute: false
|
|
123
|
+
isReferenceSubAttribute: false,
|
|
124
|
+
attributePath: 'Identifiers/45uypcuAz/Type/45uypcyRF'
|
|
122
125
|
}
|
|
123
126
|
]);
|
|
124
127
|
});
|