@reltio/components 1.4.2207 → 1.4.2209
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/AttributesErrorsPanel/components/Error/Error.js +2 -2
- package/cjs/AttributesErrorsPanel/components/Error/Error.js +2 -2
- package/cjs/contexts/MdmModuleContext/context.d.ts +2 -0
- package/cjs/contexts/MdmModuleContext/hooks.d.ts +1 -0
- package/cjs/contexts/MdmModuleContext/hooks.js +3 -1
- package/cjs/contexts/MdmModuleContext/index.d.ts +1 -1
- package/cjs/contexts/MdmModuleContext/index.js +2 -1
- package/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +1 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +2 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.js +8 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +49 -8
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditor/DCRValueEditor.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +2 -1
- package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +14 -8
- package/cjs/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.d.ts +2 -0
- package/cjs/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.js +44 -0
- package/cjs/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.module.css.js +9 -0
- package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +12 -7
- package/cjs/features/workflow/TaskActionButtons/TaskActionButtons.js +6 -4
- package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +10 -3
- package/cjs/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.js +6 -4
- package/cjs/features/workflow/{ChangeRequestEditor/context → contexts/ChangeRequestEditorContext}/index.d.ts +20 -10
- package/cjs/features/workflow/{ChangeRequestEditor/context → contexts/ChangeRequestEditorContext}/index.js +40 -2
- package/cjs/features/workflow/helpers/dcr.d.ts +8 -1
- package/cjs/features/workflow/helpers/dcr.js +186 -1
- package/cjs/features/workflow/helpers/merge.js +3 -3
- package/cjs/features/workflow/helpers/validation.d.ts +17 -0
- package/cjs/features/workflow/helpers/validation.js +333 -0
- package/cjs/features/workflow/hooks/useApplyDcrChanges.d.ts +3 -0
- package/cjs/features/workflow/hooks/useApplyDcrChanges.js +155 -0
- package/cjs/features/workflow/hooks/useDCRValidation.d.ts +5 -0
- package/cjs/features/workflow/hooks/useDCRValidation.js +153 -0
- package/cjs/features/workflow/hooks/useWorkflowActions.d.ts +7 -2
- package/cjs/features/workflow/hooks/useWorkflowActions.js +31 -8
- package/cjs/features/workflow/types.d.ts +12 -1
- package/cjs/hooks/useScrollToAttributeError/useScrollToAttributeError.d.ts +2 -1
- package/cjs/hooks/useScrollToAttributeError/useScrollToAttributeError.js +2 -2
- package/contexts/MdmModuleContext/context.d.ts +2 -0
- package/contexts/MdmModuleContext/hooks.d.ts +1 -0
- package/contexts/MdmModuleContext/hooks.js +1 -0
- package/contexts/MdmModuleContext/index.d.ts +1 -1
- package/contexts/MdmModuleContext/index.js +1 -1
- package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +1 -2
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +2 -1
- package/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.js +8 -3
- package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +23 -5
- package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
- package/features/workflow/ChangeRequestEditor/components/DCRValueEditor/DCRValueEditor.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +2 -1
- package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +8 -2
- package/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.d.ts +2 -0
- package/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.js +14 -0
- package/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.module.css.js +9 -0
- package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +12 -7
- package/features/workflow/TaskActionButtons/TaskActionButtons.js +6 -4
- package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +11 -4
- package/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.js +6 -4
- package/features/workflow/{ChangeRequestEditor/context → contexts/ChangeRequestEditorContext}/index.d.ts +20 -10
- package/features/workflow/{ChangeRequestEditor/context → contexts/ChangeRequestEditorContext}/index.js +41 -3
- package/features/workflow/helpers/dcr.d.ts +8 -1
- package/features/workflow/helpers/dcr.js +186 -2
- package/features/workflow/helpers/merge.js +3 -3
- package/features/workflow/helpers/validation.d.ts +17 -0
- package/features/workflow/helpers/validation.js +326 -0
- package/features/workflow/hooks/useApplyDcrChanges.d.ts +3 -0
- package/features/workflow/hooks/useApplyDcrChanges.js +151 -0
- package/features/workflow/hooks/useDCRValidation.d.ts +5 -0
- package/features/workflow/hooks/useDCRValidation.js +149 -0
- package/features/workflow/hooks/useWorkflowActions.d.ts +7 -2
- package/features/workflow/hooks/useWorkflowActions.js +31 -8
- package/features/workflow/types.d.ts +12 -1
- package/hooks/useScrollToAttributeError/useScrollToAttributeError.d.ts +2 -1
- package/hooks/useScrollToAttributeError/useScrollToAttributeError.js +2 -2
- package/package.json +2 -2
package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const styles = {"changeItemRow":"ChangeItemRow-changeItemRow--oF9hn","rejectButton":"ChangeItemRow-rejectButton--iNbfM","changedRow":"ChangeItemRow-changedRow--32zBa","rejectedRow":"ChangeItemRow-rejectedRow--RqKQc"};
|
|
1
|
+
const styles = {"changeItemRow":"ChangeItemRow-changeItemRow--oF9hn","changeItemRowWithError":"ChangeItemRow-changeItemRowWithError--oS1li","rejectButton":"ChangeItemRow-rejectButton--iNbfM","changedRow":"ChangeItemRow-changedRow--32zBa","rejectedRow":"ChangeItemRow-rejectedRow--RqKQc","errorText":"ChangeItemRow-errorText--EybHm"};
|
|
2
2
|
if (typeof document !== 'undefined') {
|
|
3
3
|
const head = document.head || document.getElementsByTagName('head')[0]
|
|
4
4
|
const style = document.createElement('style');
|
|
5
5
|
style.type = 'text/css'
|
|
6
|
-
style.innerHTML = `.ChangeItemRow-changeItemRow--oF9hn{display:flex;flex-direction:column;gap:8px;transition:background-color .2s ease}.ChangeItemRow-rejectButton--iNbfM{opacity:0}.ChangeItemRow-changeItemRow--oF9hn:hover{background:var(--mui-palette-action-hover)}.ChangeItemRow-changeItemRow--oF9hn:hover .ChangeItemRow-rejectButton--iNbfM{opacity:1}.ChangeItemRow-changedRow--32zBa{background-color:#e5eff7}.ChangeItemRow-changedRow--32zBa:hover{background-color:rgba(229,239,247,.8)}.ChangeItemRow-rejectedRow--RqKQc{background-color:#f6e7e7}.ChangeItemRow-rejectedRow--RqKQc:hover{background-color:hsla(0,45%,94%,.8)}`;
|
|
6
|
+
style.innerHTML = `.ChangeItemRow-changeItemRow--oF9hn{display:flex;flex-direction:column;gap:8px;position:relative;transition:background-color .2s ease}.ChangeItemRow-changeItemRow--oF9hn.ChangeItemRow-changeItemRowWithError--oS1li:before{bottom:-4px;height:auto;left:-8px;right:-8px;top:-4px;width:auto}.ChangeItemRow-rejectButton--iNbfM{opacity:0}.ChangeItemRow-changeItemRow--oF9hn:hover{background:var(--mui-palette-action-hover)}.ChangeItemRow-changeItemRow--oF9hn:hover .ChangeItemRow-rejectButton--iNbfM{opacity:1}.ChangeItemRow-changedRow--32zBa{background-color:#e5eff7}.ChangeItemRow-changedRow--32zBa:hover{background-color:rgba(229,239,247,.8)}.ChangeItemRow-rejectedRow--RqKQc{background-color:#f6e7e7}.ChangeItemRow-rejectedRow--RqKQc:hover{background-color:hsla(0,45%,94%,.8)}.ChangeItemRow-errorText--EybHm{padding:0 0 4px 180px}`;
|
|
7
7
|
head.appendChild(style);
|
|
8
8
|
}
|
|
9
9
|
export default styles;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AttributeType, ChangeValue, PrimitiveValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
3
|
-
import { LineDataValue } from '
|
|
3
|
+
import { LineDataValue } from '../../../types';
|
|
4
4
|
type Props = {
|
|
5
5
|
attributeType: AttributeType;
|
|
6
6
|
value: LineDataValue | ChangeValue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AttributeType, ChangeValue, DataTypeDefinition, PrimitiveValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
3
|
-
import { LineDataValue } from '
|
|
3
|
+
import { LineDataValue } from '../../../types';
|
|
4
4
|
type Props = {
|
|
5
5
|
attributeType: AttributeType;
|
|
6
6
|
value: LineDataValue | ChangeValue;
|
|
@@ -7,10 +7,11 @@ export declare const useChangeRequestEditor: ({ change }: Props) => {
|
|
|
7
7
|
handleChange: (newValue: SimpleAttributeValue | string[] | PrimitiveValue) => void;
|
|
8
8
|
handleReject: () => void;
|
|
9
9
|
handleRevert: () => void;
|
|
10
|
-
lineData: import("
|
|
10
|
+
lineData: import("../../types").LineData;
|
|
11
11
|
isLineRejected: boolean;
|
|
12
12
|
isParentLineRejected: boolean;
|
|
13
13
|
isUpdated: boolean;
|
|
14
14
|
hasChangeId: boolean;
|
|
15
|
+
isSubAttributeOfDeletedAttribute: any;
|
|
15
16
|
};
|
|
16
17
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
2
|
import { useContextSelector } from '@fluentui/react-context-selector';
|
|
3
|
-
import {
|
|
3
|
+
import { DCROperationTypes } from '@reltio/mdm-sdk';
|
|
4
|
+
import { ChangeRequestEditorContext } from '../../contexts/ChangeRequestEditorContext';
|
|
4
5
|
import { extractLineIds } from '../../helpers/merge';
|
|
5
6
|
var emptyLineIds = [];
|
|
6
7
|
export var useChangeRequestEditor = function (_a) {
|
|
@@ -16,6 +17,10 @@ export var useChangeRequestEditor = function (_a) {
|
|
|
16
17
|
var isUpdated = useContextSelector(ChangeRequestEditorContext, function (context) { return context.getIsLineUpdated(lineIds[0]); });
|
|
17
18
|
var isLineRejected = lineData === null || lineData === void 0 ? void 0 : lineData.isRejected;
|
|
18
19
|
var hasChangeId = lineIds.length > 0;
|
|
20
|
+
var isSubAttributeOfDeletedAttribute = change.operation === DCROperationTypes.DELETED &&
|
|
21
|
+
change.level > 0 &&
|
|
22
|
+
lineIds.length > 0 &&
|
|
23
|
+
lineIds[0].includes('/value/');
|
|
19
24
|
var handleChange = useCallback(function (newValue) {
|
|
20
25
|
updateChange(lineIds, typeof newValue === 'object' && 'value' in newValue ? newValue : { value: newValue });
|
|
21
26
|
}, [lineIds, updateChange]);
|
|
@@ -33,6 +38,7 @@ export var useChangeRequestEditor = function (_a) {
|
|
|
33
38
|
isLineRejected: isLineRejected,
|
|
34
39
|
isParentLineRejected: isParentLineRejected,
|
|
35
40
|
isUpdated: isUpdated,
|
|
36
|
-
hasChangeId: hasChangeId
|
|
41
|
+
hasChangeId: hasChangeId,
|
|
42
|
+
isSubAttributeOfDeletedAttribute: isSubAttributeOfDeletedAttribute
|
|
37
43
|
};
|
|
38
44
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { useContextSelector } from '@fluentui/react-context-selector';
|
|
3
|
+
import { ChangeRequestEditorContext } from '../../contexts/ChangeRequestEditorContext';
|
|
4
|
+
import { AttributesErrorsPanel } from '../../../../AttributesErrorsPanel';
|
|
5
|
+
import styles from './DCRErrorsPanel.module.css';
|
|
6
|
+
export var DCRErrorsPanel = function () {
|
|
7
|
+
var errors = useContextSelector(ChangeRequestEditorContext, function (context) { return context.getErrors(); });
|
|
8
|
+
var validationErrors = useMemo(function () { return errors.map(function (error) { return error.error; }); }, [errors]);
|
|
9
|
+
if (validationErrors.length === 0) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return (React.createElement("div", { className: styles.DCRErrorsPanel },
|
|
13
|
+
React.createElement(AttributesErrorsPanel, { attributesWithErrors: validationErrors })));
|
|
14
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const styles = {"DCRErrorsPanel":"DCRErrorsPanel-DCRErrorsPanel--7zw3p"};
|
|
2
|
+
if (typeof document !== 'undefined') {
|
|
3
|
+
const head = document.head || document.getElementsByTagName('head')[0]
|
|
4
|
+
const style = document.createElement('style');
|
|
5
|
+
style.type = 'text/css'
|
|
6
|
+
style.innerHTML = `.DCRErrorsPanel-DCRErrorsPanel--7zw3p{margin-bottom:16px}`;
|
|
7
|
+
head.appendChild(style);
|
|
8
|
+
}
|
|
9
|
+
export default styles;
|
|
@@ -9,7 +9,6 @@ import i18n from 'ui-i18n';
|
|
|
9
9
|
import { useWorkflowCheckPermission } from '../hooks/useWorkflowCheckPermission';
|
|
10
10
|
import { useWorkflowActions } from '../hooks/useWorkflowActions';
|
|
11
11
|
import { useMdmEntity } from '../../../contexts/MdmModuleContext';
|
|
12
|
-
import { ChangeRequestEditorProvider } from '../ChangeRequestEditor/context';
|
|
13
12
|
import { ProfileBand } from '../../../ProfileBand';
|
|
14
13
|
import { DueDateField } from '../DueDateField';
|
|
15
14
|
import { PrioritySelector } from '../PrioritySelector';
|
|
@@ -18,17 +17,23 @@ import { WorkflowComments } from '../WorkflowComments';
|
|
|
18
17
|
import { WorkflowActionButtons } from '../WorkflowActionButtons';
|
|
19
18
|
import { DCRSummaryInfo } from './components/DCRSummaryInfo/DCRSummaryInfo';
|
|
20
19
|
import { ChangeRequestEditor } from '../ChangeRequestEditor';
|
|
20
|
+
import { useApplyDcrChanges } from '../hooks/useApplyDcrChanges';
|
|
21
|
+
import { DCRErrorsPanel } from './DCRErrorsPanel/DCRErrorsPanel';
|
|
21
22
|
import styles from './ReviewDCRDialog.module.css';
|
|
22
23
|
export var ReviewDCRDialog = function (_a) {
|
|
23
24
|
var open = _a.open, onClose = _a.onClose, dcr = _a.dcr, task = _a.task, groupedObjects = _a.groupedObjects;
|
|
24
25
|
var entity = useMdmEntity();
|
|
25
26
|
var checkWorkflowPermission = useWorkflowCheckPermission();
|
|
26
27
|
var canViewComments = checkWorkflowPermission('VIEW_PROCESS_INSTANCE_COMMENTS');
|
|
28
|
+
var applyDcrChanges = useApplyDcrChanges(dcr);
|
|
27
29
|
var _b = useWorkflowActions({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
task: {
|
|
31
|
+
taskId: task.taskId,
|
|
32
|
+
possibleActions: task.possibleActions,
|
|
33
|
+
assignee: task.assignee,
|
|
34
|
+
isOpen: task.isOpen
|
|
35
|
+
},
|
|
36
|
+
beforeAction: applyDcrChanges
|
|
32
37
|
}), workflowActions = _b.actions, actionRequestIsInProgress = _b.actionRequestIsInProgress;
|
|
33
38
|
return (React.createElement(Dialog, { open: open, onClose: onClose, fullScreen: true },
|
|
34
39
|
React.createElement(DialogTitle, { className: styles.dialogTitle },
|
|
@@ -39,6 +44,7 @@ export var ReviewDCRDialog = function (_a) {
|
|
|
39
44
|
React.createElement(DialogContent, { classes: { root: styles.content } },
|
|
40
45
|
React.createElement("div", { className: styles.leftSection },
|
|
41
46
|
React.createElement(ProfileBand, { entity: entity, className: styles.profileBandRoot, classes: { profileBand: styles.profileBand } }),
|
|
47
|
+
React.createElement(DCRErrorsPanel, null),
|
|
42
48
|
React.createElement(DCRSummaryInfo, { dcr: dcr, task: task, groupedObjects: groupedObjects }),
|
|
43
49
|
React.createElement("div", { className: styles.editableSection },
|
|
44
50
|
React.createElement("div", { className: styles.editableGrid },
|
|
@@ -49,8 +55,7 @@ export var ReviewDCRDialog = function (_a) {
|
|
|
49
55
|
React.createElement("div", { className: styles.editableItem },
|
|
50
56
|
React.createElement(AssigneeSelector, { taskId: task.taskId, assignee: task.assignee, isTaskOpen: task.isOpen })))),
|
|
51
57
|
React.createElement("div", { className: styles.changesSection },
|
|
52
|
-
React.createElement(
|
|
53
|
-
React.createElement(ChangeRequestEditor, { dcr: dcr, task: task, groupedObjects: groupedObjects })))),
|
|
58
|
+
React.createElement(ChangeRequestEditor, { dcr: dcr, task: task, groupedObjects: groupedObjects }))),
|
|
54
59
|
canViewComments && (React.createElement(WorkflowComments, { workflowActions: workflowActions, actionRequestIsInProgress: actionRequestIsInProgress, preferredAction: task.preferredAction, taskId: task.taskId, processInstanceComments: task.processInstanceComments, isTaskOpen: task.isOpen, showActionButtons: false, alwaysExpanded: true, classes: {
|
|
55
60
|
container: styles.commentsRootContainer,
|
|
56
61
|
commentsContainer: styles.commentsContainer
|
|
@@ -6,10 +6,12 @@ export var TaskActionButtons = function (_a) {
|
|
|
6
6
|
var task = _a.task;
|
|
7
7
|
var taskId = task.taskId, possibleActions = task.possibleActions, assignee = task.assignee, isOpen = task.isOpen, preferredAction = task.preferredAction;
|
|
8
8
|
var _b = useWorkflowActions({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
task: {
|
|
10
|
+
taskId: taskId,
|
|
11
|
+
possibleActions: possibleActions,
|
|
12
|
+
assignee: assignee,
|
|
13
|
+
isOpen: isOpen
|
|
14
|
+
}
|
|
13
15
|
}), actions = _b.actions, disabled = _b.actionRequestIsInProgress;
|
|
14
16
|
var _c = partition(propEq('text', preferredAction === null || preferredAction === void 0 ? void 0 : preferredAction.label), actions), preferredActions = _c[0], otherActions = _c[1];
|
|
15
17
|
return (React.createElement(React.Fragment, null,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useCallback, useContext, useMemo, useState } from 'react';
|
|
2
2
|
import { isNil } from 'ramda';
|
|
3
|
+
import { isDCRUri } from '@reltio/mdm-sdk';
|
|
3
4
|
import DcrTaskIcon from '../../../../../icons/DcrTaskIcon';
|
|
4
|
-
import { useMdmReviewDCREnabled, useMdmUsername } from '../../../../../contexts/MdmModuleContext';
|
|
5
|
+
import { useMdmEntity, useMdmReviewDCREnabled, useMdmUsername } from '../../../../../contexts/MdmModuleContext';
|
|
5
6
|
import { GenericWorkflowTaskCard } from '../GenericWorkflowTaskCard';
|
|
6
7
|
import { AttributesChanges } from '../../../AttributesChanges';
|
|
7
8
|
import { LineDecorator } from '../../../LineDecorator';
|
|
@@ -9,11 +10,15 @@ import { useChangeRequest } from '../../../hooks/useChangeRequest';
|
|
|
9
10
|
import { getDCRUri } from '../../../helpers/common';
|
|
10
11
|
import { ReviewDCRDialog } from '../../../ReviewDCRDialog';
|
|
11
12
|
import { ReviewDCRButton } from '../../../ReviewDCRButton';
|
|
13
|
+
import { ChangeRequestEditorProvider } from '../../../contexts/ChangeRequestEditorContext';
|
|
12
14
|
import { WorkflowTasksContext } from '../../../../../contexts/WorkflowTasksContext';
|
|
15
|
+
import { ScrollToElementProvider } from '../../../../../contexts/ScrollToElementContext';
|
|
13
16
|
export var DataChangeRequestTaskCard = function (_a) {
|
|
14
17
|
var task = _a.task;
|
|
15
18
|
var reviewDCREnabledByEntityType = (useContext(WorkflowTasksContext) || {}).reviewDCR;
|
|
16
19
|
var reviewDCREnabled = useMdmReviewDCREnabled();
|
|
20
|
+
var entity = useMdmEntity();
|
|
21
|
+
var isDCREntity = isDCRUri(entity === null || entity === void 0 ? void 0 : entity.uri);
|
|
17
22
|
var isReviewDCREnabled = isNil(reviewDCREnabledByEntityType) ? reviewDCREnabled : reviewDCREnabledByEntityType;
|
|
18
23
|
var username = useMdmUsername();
|
|
19
24
|
var _b = useState(false), isReviewDCRDialogOpen = _b[0], setIsReviewDCRDialogOpen = _b[1];
|
|
@@ -26,12 +31,14 @@ export var DataChangeRequestTaskCard = function (_a) {
|
|
|
26
31
|
var handleCloseReviewDCRDialog = useCallback(function () {
|
|
27
32
|
setIsReviewDCRDialogOpen(false);
|
|
28
33
|
}, []);
|
|
29
|
-
var showReviewDCRButton = isReviewDCREnabled && assignee == username;
|
|
30
|
-
var showReviewDialog = isReviewDCRDialogOpen && (showReviewDCRButton || isReviewDCREnabled);
|
|
34
|
+
var showReviewDCRButton = !isDCREntity && isReviewDCREnabled && assignee == username;
|
|
35
|
+
var showReviewDialog = !isDCREntity && isReviewDCRDialogOpen && (showReviewDCRButton || isReviewDCREnabled);
|
|
31
36
|
var customActionsSlot = useMemo(function () { return showReviewDCRButton && React.createElement(ReviewDCRButton, { onClick: handleReviewDCR }); }, [showReviewDCRButton, handleReviewDCR]);
|
|
32
37
|
return (React.createElement(React.Fragment, null,
|
|
33
38
|
React.createElement(GenericWorkflowTaskCard, { task: task, Icon: DcrTaskIcon, customActionsSlot: customActionsSlot }, dcr &&
|
|
34
39
|
groupedObjects.map(function (object, index) { return (React.createElement(LineDecorator, { key: index, last: index === groupedObjects.length - 1, divider: true },
|
|
35
40
|
React.createElement(AttributesChanges, { entityInfo: object.entity, relationsInfo: object.relations, changes: dcr.changes, objectsInfo: dcr.objectsInfo, dcrUri: dcrUri }))); })),
|
|
36
|
-
showReviewDialog && (React.createElement(
|
|
41
|
+
showReviewDialog && (React.createElement(ChangeRequestEditorProvider, null,
|
|
42
|
+
React.createElement(ScrollToElementProvider, null,
|
|
43
|
+
React.createElement(ReviewDCRDialog, { open: isReviewDCRDialogOpen, onClose: handleCloseReviewDCRDialog, dcr: dcr, groupedObjects: groupedObjects, task: task }))))));
|
|
37
44
|
};
|
|
@@ -26,10 +26,12 @@ export var GenericWorkflowTaskCard = function (_a) {
|
|
|
26
26
|
var checkWorkflowPermission = useWorkflowCheckPermission();
|
|
27
27
|
var canViewComments = checkWorkflowPermission('VIEW_PROCESS_INSTANCE_COMMENTS');
|
|
28
28
|
var _d = useWorkflowActions({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
task: {
|
|
30
|
+
taskId: taskId,
|
|
31
|
+
possibleActions: possibleActions,
|
|
32
|
+
assignee: assignee,
|
|
33
|
+
isOpen: isTaskOpen
|
|
34
|
+
}
|
|
33
35
|
}), workflowActions = _d.actions, actionRequestIsInProgress = _d.actionRequestIsInProgress;
|
|
34
36
|
return (React.createElement("div", { className: styles.card },
|
|
35
37
|
React.createElement("div", { className: classnames((_b = {}, _b[styles.withBackground] = isExpanded, _b)) },
|
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
export type LineData = {
|
|
7
|
-
value?: LineDataValue;
|
|
8
|
-
isRejected?: boolean;
|
|
9
|
-
};
|
|
10
|
-
type ChangeRequestEditorContextType = {
|
|
2
|
+
import { AttributeError } from '@reltio/mdm-sdk';
|
|
3
|
+
import { LineData, LineDataValue } from '../../types';
|
|
4
|
+
export type ChangeRequestEditorContextType = {
|
|
11
5
|
updateChange: (lineIds: string[], data: LineDataValue) => void;
|
|
12
6
|
getLineData: (lineId: string) => LineData | undefined;
|
|
7
|
+
getLinesByChangeId: (changeId: string) => Array<[string, LineData]>;
|
|
13
8
|
rejectChange: (lineIds: string[]) => void;
|
|
14
9
|
revertChangeUpdateOrReject: (lineIds: string[]) => void;
|
|
15
10
|
getIsParentLineRejected: (lineId: string) => boolean;
|
|
16
11
|
getIsLineRejected: (lineId: string) => boolean;
|
|
17
12
|
getIsLineUpdated: (lineId: string) => boolean;
|
|
13
|
+
getAllChanges: () => {
|
|
14
|
+
lineId: string;
|
|
15
|
+
data: LineData;
|
|
16
|
+
}[];
|
|
17
|
+
setErrors: (errors: {
|
|
18
|
+
error: AttributeError;
|
|
19
|
+
lineIds: string[];
|
|
20
|
+
}[]) => void;
|
|
21
|
+
getErrorByLineId: (lineId: string) => {
|
|
22
|
+
error: AttributeError;
|
|
23
|
+
lineIds: string[];
|
|
24
|
+
} | undefined;
|
|
25
|
+
getErrors: () => {
|
|
26
|
+
error: AttributeError;
|
|
27
|
+
lineIds: string[];
|
|
28
|
+
}[];
|
|
18
29
|
};
|
|
19
30
|
export declare const ChangeRequestEditorContext: import("@fluentui/react-context-selector").Context<ChangeRequestEditorContextType>;
|
|
20
31
|
export declare const ChangeRequestEditorProvider: ({ children }: {
|
|
21
32
|
children: React.ReactNode;
|
|
22
33
|
}) => React.JSX.Element;
|
|
23
|
-
export {};
|
|
@@ -1,18 +1,26 @@
|
|
|
1
|
-
import React, { useCallback, useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { isNil } from 'ramda';
|
|
3
3
|
import { createContext } from '@fluentui/react-context-selector';
|
|
4
4
|
export var ChangeRequestEditorContext = createContext({
|
|
5
5
|
updateChange: undefined,
|
|
6
6
|
getLineData: undefined,
|
|
7
|
+
getLinesByChangeId: undefined,
|
|
7
8
|
rejectChange: undefined,
|
|
8
9
|
revertChangeUpdateOrReject: undefined,
|
|
9
10
|
getIsParentLineRejected: undefined,
|
|
10
11
|
getIsLineRejected: undefined,
|
|
11
|
-
getIsLineUpdated: undefined
|
|
12
|
+
getIsLineUpdated: undefined,
|
|
13
|
+
getAllChanges: undefined,
|
|
14
|
+
setErrors: undefined,
|
|
15
|
+
getErrorByLineId: undefined,
|
|
16
|
+
getErrors: undefined
|
|
12
17
|
});
|
|
18
|
+
var emptyArray = [];
|
|
13
19
|
export var ChangeRequestEditorProvider = function (_a) {
|
|
14
20
|
var children = _a.children;
|
|
15
21
|
var _b = useState(new Map()), lineDataMap = _b[0], setLineDataMap = _b[1];
|
|
22
|
+
var lineDataMapRef = useRef(lineDataMap);
|
|
23
|
+
var _c = useState([]), errors = _c[0], setErrors = _c[1];
|
|
16
24
|
var updateChange = useCallback(function (lineIds, data) {
|
|
17
25
|
setLineDataMap(function (prevMap) {
|
|
18
26
|
var newMap = new Map(prevMap);
|
|
@@ -62,14 +70,44 @@ export var ChangeRequestEditorProvider = function (_a) {
|
|
|
62
70
|
var _a;
|
|
63
71
|
return !isNil((_a = lineDataMap.get(lineId)) === null || _a === void 0 ? void 0 : _a.value);
|
|
64
72
|
}, [lineDataMap]);
|
|
73
|
+
var getLinesByChangeId = useCallback(function (changeId) {
|
|
74
|
+
return Array.from(lineDataMapRef.current).filter(function (_a) {
|
|
75
|
+
var key = _a[0], _value = _a[1];
|
|
76
|
+
return key.split('/')[1] === changeId;
|
|
77
|
+
});
|
|
78
|
+
}, []);
|
|
79
|
+
var getAllChanges = useCallback(function () {
|
|
80
|
+
var changes = Array.from(lineDataMapRef.current).map(function (_a) {
|
|
81
|
+
var lineId = _a[0], data = _a[1];
|
|
82
|
+
return ({ lineId: lineId, data: data });
|
|
83
|
+
});
|
|
84
|
+
return changes.length > 0 ? changes : emptyArray;
|
|
85
|
+
}, []);
|
|
86
|
+
useEffect(function () {
|
|
87
|
+
lineDataMapRef.current = lineDataMap;
|
|
88
|
+
}, [lineDataMap]);
|
|
89
|
+
var getErrorByLineId = useCallback(function (lineId) {
|
|
90
|
+
return errors.find(function (_a) {
|
|
91
|
+
var lineIds = _a.lineIds;
|
|
92
|
+
return lineIds.includes(lineId);
|
|
93
|
+
});
|
|
94
|
+
}, [errors]);
|
|
95
|
+
var getErrors = useCallback(function () {
|
|
96
|
+
return errors;
|
|
97
|
+
}, [errors]);
|
|
65
98
|
var contextValue = {
|
|
66
99
|
updateChange: updateChange,
|
|
67
100
|
getLineData: getLineData,
|
|
101
|
+
getLinesByChangeId: getLinesByChangeId,
|
|
68
102
|
rejectChange: rejectChange,
|
|
69
103
|
revertChangeUpdateOrReject: revertChangeUpdateOrReject,
|
|
70
104
|
getIsParentLineRejected: getIsParentLineRejected,
|
|
71
105
|
getIsLineRejected: getIsLineRejected,
|
|
72
|
-
getIsLineUpdated: getIsLineUpdated
|
|
106
|
+
getIsLineUpdated: getIsLineUpdated,
|
|
107
|
+
getAllChanges: getAllChanges,
|
|
108
|
+
setErrors: setErrors,
|
|
109
|
+
getErrorByLineId: getErrorByLineId,
|
|
110
|
+
getErrors: getErrors
|
|
73
111
|
};
|
|
74
112
|
return React.createElement(ChangeRequestEditorContext.Provider, { value: contextValue }, children);
|
|
75
113
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ChangeRequest, DCRChanges, DCRObjectInfo, DCRObjectsInfo, GroupedObjectsInfo } from '@reltio/mdm-sdk';
|
|
1
|
+
import { AttributeDelete, ChangeRequest, DCRChange, DCRChanges, DCRObjectInfo, DCRObjectsInfo, GroupedObjectsInfo, Metadata } from '@reltio/mdm-sdk';
|
|
2
|
+
import { LineData } from '../types';
|
|
2
3
|
export declare const getEntitiesObjects: any;
|
|
3
4
|
export declare const getRelationsObjects: any;
|
|
4
5
|
export declare const extractObjectsFromChangeRequest: (changes: DCRChanges, objectsInfo: DCRObjectsInfo) => DCRObjectInfo[];
|
|
@@ -7,3 +8,9 @@ export declare const createEntityRelationsObjectByRelation: any;
|
|
|
7
8
|
export declare const concatEntityRelationsObjects: (acc: Record<string, GroupedObjectsInfo>, object: GroupedObjectsInfo) => Record<string, GroupedObjectsInfo>;
|
|
8
9
|
export declare const getEntityUriForChangeRequest: (dcrUri: string, entityUri: string) => string;
|
|
9
10
|
export declare const isCreateEntityOperation: (dcr: ChangeRequest) => boolean;
|
|
11
|
+
export declare const buildDCRSavePlan: (changes: DCRChanges, getLinesByChangeId: (changeId: string) => Array<[string, LineData]>, metadata: Metadata) => {
|
|
12
|
+
rejectedChangeIds: string[];
|
|
13
|
+
updatedChanges: Record<string, DCRChange[]>;
|
|
14
|
+
deleteEntityAttributes: Record<string, AttributeDelete[]>;
|
|
15
|
+
deleteRelationAttributes: Record<string, AttributeDelete[]>;
|
|
16
|
+
};
|
|
@@ -9,8 +9,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
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 { createEntryDeleteAttribute, DCRTypes, findAttributeTypeByUri, isEntityUri, isNested, isRelationTypeUri, isRelationUri } from '@reltio/mdm-sdk';
|
|
22
|
+
import { allPass, append, assocPath, concat, curry, dissocPath, equals, filter, flatten, fromPairs, groupBy, has, hasPath, isEmpty, isNil, keys, map, partition, path, pathOr, pipe, pluck, prop, propOr, toPairs, values, uniq, uniqBy, when } from 'ramda';
|
|
14
23
|
export var getEntitiesObjects = filter(pipe(prop('uri'), isEntityUri));
|
|
15
24
|
export var getRelationsObjects = filter(pipe(prop('uri'), isRelationUri));
|
|
16
25
|
var getRelations = function (objectsWithChanges, entityUri) {
|
|
@@ -47,3 +56,178 @@ export var getEntityUriForChangeRequest = function (dcrUri, entityUri) {
|
|
|
47
56
|
export var isCreateEntityOperation = function (dcr) {
|
|
48
57
|
return dcr.type === DCRTypes.CREATE_ENTITY;
|
|
49
58
|
};
|
|
59
|
+
var cleanValueRecursively = function (value) {
|
|
60
|
+
if (typeof value === 'string' || isEmpty(value)) {
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
var cleanedProperties = map(function (propertyValues) {
|
|
64
|
+
return propertyValues
|
|
65
|
+
.map(function (item) {
|
|
66
|
+
var itemValue = item.value;
|
|
67
|
+
var cleanedItemValue = itemValue && typeof itemValue === 'object' ? cleanValueRecursively(itemValue) : itemValue;
|
|
68
|
+
return __assign(__assign({}, item), { value: cleanedItemValue });
|
|
69
|
+
})
|
|
70
|
+
.filter(function (item) {
|
|
71
|
+
var itemValue = item.value;
|
|
72
|
+
return !isEmpty(itemValue) && !isNil(itemValue);
|
|
73
|
+
});
|
|
74
|
+
}, value);
|
|
75
|
+
return filter(function (propertyValues) { return !isEmpty(propertyValues); }, cleanedProperties);
|
|
76
|
+
};
|
|
77
|
+
var cleanChange = function (change) {
|
|
78
|
+
var _a, _b, _c;
|
|
79
|
+
if (Array.isArray(change.newValue)) {
|
|
80
|
+
return change;
|
|
81
|
+
}
|
|
82
|
+
if (isRelationTypeUri(change.objectType)) {
|
|
83
|
+
if (change.type === DCRTypes.INSERT_ATTRIBUTE || change.type === DCRTypes.UPDATE_ATTRIBUTE) {
|
|
84
|
+
var cleanedValues = cleanValueRecursively((_a = change.newValue) === null || _a === void 0 ? void 0 : _a.value);
|
|
85
|
+
return assocPath(['newValue', 'value'], cleanedValues, change);
|
|
86
|
+
}
|
|
87
|
+
var cleanedAttributes = cleanValueRecursively((_b = change.newValue) === null || _b === void 0 ? void 0 : _b.attributes);
|
|
88
|
+
var changeWithCleanedAttributes = assocPath(['newValue', 'attributes'], cleanedAttributes, change);
|
|
89
|
+
if (change.type === DCRTypes.CREATE_RELATIONSHIP) {
|
|
90
|
+
var cleanByPath = function (valuePath) {
|
|
91
|
+
return when(allPass([hasPath(valuePath), pipe(path(valuePath), isNil)]), dissocPath(valuePath));
|
|
92
|
+
};
|
|
93
|
+
return pipe(cleanByPath(['newValue', 'startDate']), cleanByPath(['newValue', 'endDate']))(changeWithCleanedAttributes);
|
|
94
|
+
}
|
|
95
|
+
return changeWithCleanedAttributes;
|
|
96
|
+
}
|
|
97
|
+
if (typeof change.newValue === 'object') {
|
|
98
|
+
var cleanedValue = cleanValueRecursively((_c = change.newValue) === null || _c === void 0 ? void 0 : _c.value);
|
|
99
|
+
return assocPath(['newValue', 'value'], cleanedValue, change);
|
|
100
|
+
}
|
|
101
|
+
return change;
|
|
102
|
+
};
|
|
103
|
+
var calculateValuePath = function (key, change) {
|
|
104
|
+
var path = key
|
|
105
|
+
.split('/')
|
|
106
|
+
.slice(2)
|
|
107
|
+
.map(function (part) { return (isNaN(Number(part)) ? part : parseInt(part)); });
|
|
108
|
+
switch (change.type) {
|
|
109
|
+
case DCRTypes.UPDATE_TAGS:
|
|
110
|
+
case DCRTypes.UPDATE_ROLES:
|
|
111
|
+
return path;
|
|
112
|
+
case DCRTypes.UPDATE_START_DATE:
|
|
113
|
+
case DCRTypes.UPDATE_END_DATE:
|
|
114
|
+
return __spreadArray(__spreadArray([], path, true), [0], false);
|
|
115
|
+
case DCRTypes.CREATE_RELATIONSHIP:
|
|
116
|
+
if (path.length === 2) {
|
|
117
|
+
if (path[1] === 'activeness.startDate') {
|
|
118
|
+
return [path[0], 'startDate'];
|
|
119
|
+
}
|
|
120
|
+
if (path[1] === 'activeness.endDate') {
|
|
121
|
+
return [path[0], 'endDate'];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return __spreadArray(__spreadArray([], path, true), ['value'], false);
|
|
125
|
+
default:
|
|
126
|
+
return __spreadArray(__spreadArray([], path, true), ['value'], false);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
var valuesAreEqual = function (oldValue, newValue) {
|
|
130
|
+
var sortWithLocale = function (array) { return array.slice().sort(function (a, b) { return a.localeCompare(b); }); };
|
|
131
|
+
if (Array.isArray(oldValue) && Array.isArray(newValue)) {
|
|
132
|
+
return oldValue.length === newValue.length && equals(sortWithLocale(oldValue), sortWithLocale(newValue));
|
|
133
|
+
}
|
|
134
|
+
if (typeof oldValue === 'string' && typeof newValue === 'number') {
|
|
135
|
+
return oldValue === newValue.toString();
|
|
136
|
+
}
|
|
137
|
+
return oldValue === newValue;
|
|
138
|
+
};
|
|
139
|
+
var getOldValueByNewValuePath = function (valuePath, change) {
|
|
140
|
+
if (valuePath.includes('newValue')) {
|
|
141
|
+
return pathOr(null, valuePath.map(function (item) { return (item === 'newValue' ? 'oldValue' : item); }), change);
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
};
|
|
145
|
+
export var buildDCRSavePlan = function (changes, getLinesByChangeId, metadata) {
|
|
146
|
+
var _a, _b;
|
|
147
|
+
var rejectedChangeIds = [];
|
|
148
|
+
var updatedChanges = {};
|
|
149
|
+
var deleteAttributes = {};
|
|
150
|
+
for (var _i = 0, _c = Object.entries(changes); _i < _c.length; _i++) {
|
|
151
|
+
var _d = _c[_i], objectUri = _d[0], objectChanges = _d[1];
|
|
152
|
+
var rawChanges = new Map();
|
|
153
|
+
var _loop_1 = function (change) {
|
|
154
|
+
var _h = pipe(prop('id'), getLinesByChangeId, partition(function (_a) {
|
|
155
|
+
var _b;
|
|
156
|
+
var key = _a[0], lineData = _a[1];
|
|
157
|
+
return key.split('/').length === 3 &&
|
|
158
|
+
(lineData.isRejected ||
|
|
159
|
+
(isEmpty((_b = lineData.value) === null || _b === void 0 ? void 0 : _b.value) && change.type !== DCRTypes.UPDATE_ATTRIBUTE));
|
|
160
|
+
}))(change), rejectedRootLines = _h[0], otherLines = _h[1];
|
|
161
|
+
rejectedChangeIds.push.apply(rejectedChangeIds, rejectedRootLines.map(function (_a) {
|
|
162
|
+
var key = _a[0];
|
|
163
|
+
return key.split('/')[1];
|
|
164
|
+
}));
|
|
165
|
+
var rejectedRootLinesMap = new Map(rejectedRootLines);
|
|
166
|
+
for (var _j = 0, otherLines_1 = otherLines; _j < otherLines_1.length; _j++) {
|
|
167
|
+
var _k = otherLines_1[_j], key = _k[0], lineData = _k[1];
|
|
168
|
+
var rootId = key.split('/').slice(0, 3).join('/');
|
|
169
|
+
var newValue = (_a = lineData.value) === null || _a === void 0 ? void 0 : _a.value;
|
|
170
|
+
if (rootId === key && change.type === DCRTypes.UPDATE_ATTRIBUTE && isEmpty(newValue)) {
|
|
171
|
+
var attributeUri = [objectUri, 'attributes', change.attributePath].join('/');
|
|
172
|
+
var entry = __assign(__assign({}, createEntryDeleteAttribute({ uri: attributeUri })[0]), (change.crosswalk && { crosswalk: change.crosswalk }));
|
|
173
|
+
deleteAttributes[objectUri] = uniqBy(prop('uri'), append(entry, propOr([], objectUri, deleteAttributes)));
|
|
174
|
+
rejectedChangeIds.push(change.id);
|
|
175
|
+
}
|
|
176
|
+
else if (!rejectedRootLinesMap.has(rootId)) {
|
|
177
|
+
var valuePath = calculateValuePath(key, change);
|
|
178
|
+
var oldDCRValue = path(valuePath, change);
|
|
179
|
+
var oldValue = getOldValueByNewValuePath(valuePath, change);
|
|
180
|
+
var initialChange = rawChanges.has(change.id) ? rawChanges.get(change.id) : change;
|
|
181
|
+
var updatedChange = void 0;
|
|
182
|
+
if (lineData.isRejected || isEmpty(newValue)) {
|
|
183
|
+
updatedChange = assocPath(valuePath, null, initialChange);
|
|
184
|
+
}
|
|
185
|
+
else if (!valuesAreEqual(oldDCRValue, newValue)) {
|
|
186
|
+
if (oldValue && valuesAreEqual(oldValue, newValue)) {
|
|
187
|
+
rejectedChangeIds.push(change.id);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
var processedNewValue = typeof oldDCRValue === 'string' && typeof newValue === 'number'
|
|
191
|
+
? newValue.toString()
|
|
192
|
+
: newValue;
|
|
193
|
+
updatedChange = assocPath(valuePath, processedNewValue, initialChange);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (updatedChange) {
|
|
197
|
+
rawChanges.set(change.id, updatedChange);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
for (var _e = 0, objectChanges_1 = objectChanges; _e < objectChanges_1.length; _e++) {
|
|
203
|
+
var change = objectChanges_1[_e];
|
|
204
|
+
_loop_1(change);
|
|
205
|
+
}
|
|
206
|
+
for (var _f = 0, _g = Array.from(rawChanges.values()); _f < _g.length; _f++) {
|
|
207
|
+
var rawChange = _g[_f];
|
|
208
|
+
var cleanedChange = cleanChange(rawChange);
|
|
209
|
+
var isNestedChange = has('attributeType', cleanedChange) &&
|
|
210
|
+
isNested(findAttributeTypeByUri(metadata, cleanedChange.attributeType));
|
|
211
|
+
if (isNestedChange && isEmpty((_b = cleanedChange.newValue) === null || _b === void 0 ? void 0 : _b.value)) {
|
|
212
|
+
rejectedChangeIds.push(cleanedChange.id);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
updatedChanges[objectUri] = append(cleanedChange, propOr([], objectUri, updatedChanges));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
var rejectedBeforeUpdateIds = pipe(values, flatten, pluck('id'))(updatedChanges);
|
|
220
|
+
rejectedChangeIds.push.apply(rejectedChangeIds, rejectedBeforeUpdateIds);
|
|
221
|
+
var deleteAttributesGroups = groupBy(function (_a) {
|
|
222
|
+
var uri = _a[0];
|
|
223
|
+
return (isRelationUri(uri) ? 'relation' : 'entity');
|
|
224
|
+
}, toPairs(deleteAttributes));
|
|
225
|
+
var deleteRelationAttributes = fromPairs(deleteAttributesGroups.relation || []);
|
|
226
|
+
var deleteEntityAttributes = fromPairs(deleteAttributesGroups.entity || []);
|
|
227
|
+
return {
|
|
228
|
+
rejectedChangeIds: rejectedChangeIds,
|
|
229
|
+
updatedChanges: updatedChanges,
|
|
230
|
+
deleteEntityAttributes: deleteEntityAttributes,
|
|
231
|
+
deleteRelationAttributes: deleteRelationAttributes
|
|
232
|
+
};
|
|
233
|
+
};
|
|
@@ -69,7 +69,7 @@ var prepareStartOrEndDate = function (_a) {
|
|
|
69
69
|
];
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
var prepareRolesOrTags = function (
|
|
72
|
+
var prepareRolesOrTags = function (change) {
|
|
73
73
|
var _a = change.newValue, newValue = _a === void 0 ? [] : _a, _b = change.oldValue, oldValue = _b === void 0 ? [] : _b;
|
|
74
74
|
var preparedNewValue = 'value' in newValue ? newValue.value : newValue;
|
|
75
75
|
var preparedOldValue = 'value' in oldValue ? oldValue.value : oldValue;
|
|
@@ -197,10 +197,10 @@ var mergeAttributesInChange = function (metadata, objectInfo, change, container)
|
|
|
197
197
|
container['defaultProfilePicValue'] = [change.newValue];
|
|
198
198
|
break;
|
|
199
199
|
case DCRTypes.UPDATE_TAGS:
|
|
200
|
-
container[EntityAttrTypes.tags.name] = prepareRolesOrTags(
|
|
200
|
+
container[EntityAttrTypes.tags.name] = prepareRolesOrTags(change);
|
|
201
201
|
break;
|
|
202
202
|
case DCRTypes.UPDATE_ROLES: {
|
|
203
|
-
container[EntityAttrTypes.roles.name] = prepareRolesOrTags(
|
|
203
|
+
container[EntityAttrTypes.roles.name] = prepareRolesOrTags(change);
|
|
204
204
|
break;
|
|
205
205
|
}
|
|
206
206
|
case DCRTypes.UPDATE_START_DATE:
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AttributeError, DCRChanges, Entity, Metadata, Relation } from '@reltio/mdm-sdk';
|
|
2
|
+
import { LineData } from '../types';
|
|
3
|
+
type UserChange = {
|
|
4
|
+
lineId: string;
|
|
5
|
+
data: LineData;
|
|
6
|
+
};
|
|
7
|
+
type ValidationError = {
|
|
8
|
+
error: AttributeError;
|
|
9
|
+
lineIds: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare const getValidationErrors: ({ changes, userChanges, entitiesOrRelations, metadata }: {
|
|
12
|
+
changes: DCRChanges;
|
|
13
|
+
userChanges: UserChange[];
|
|
14
|
+
entitiesOrRelations: Record<string, Entity | Relation>;
|
|
15
|
+
metadata: Metadata;
|
|
16
|
+
}) => ValidationError[];
|
|
17
|
+
export {};
|