@reltio/components 1.4.911 → 1.4.912
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +6 -30
- package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +7 -4
- package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.js +19 -9
- package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +4 -4
- package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/styles.js +3 -9
- package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.d.ts +2 -2
- package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.js +4 -1
- package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.d.ts +1 -0
- package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.js +13 -0
- package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.d.ts +2 -13
- package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.js +25 -9
- package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.d.ts +1 -1
- package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.js +14 -2
- package/cjs/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +1 -1
- package/cjs/components/workflow/components/AttributesChanges/helpers/attributesHelpers.d.ts +3 -2
- package/cjs/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +35 -6
- package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +4 -6
- package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.js +4 -26
- package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +3 -2
- package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +109 -28
- package/cjs/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.d.ts +3 -2
- package/cjs/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.js +4 -4
- package/cjs/components/workflow/components/AttributesChanges/types/diffTypes.d.ts +16 -0
- package/cjs/components/workflow/components/AttributesChanges/types/{DCRTypes.js → diffTypes.js} +0 -0
- package/cjs/components/workflow/components/LineDecorator/LineDecorator.d.ts +2 -1
- package/cjs/components/workflow/components/LineDecorator/LineDecorator.js +5 -2
- package/cjs/components/workflow/components/LineDecorator/styles.d.ts +1 -1
- package/cjs/components/workflow/components/LineDecorator/styles.js +4 -1
- package/cjs/components/workflow/{components/AttributesChanges/constants → constants}/operations.d.ts +0 -0
- package/cjs/components/workflow/{components/AttributesChanges/constants → constants}/operations.js +0 -0
- package/cjs/components/workflow/helpers/dcrHelpers.d.ts +7 -0
- package/cjs/components/workflow/helpers/dcrHelpers.js +48 -0
- package/cjs/components/workflow/hooks/useChangeRequest.d.ts +5 -0
- package/cjs/components/workflow/hooks/useChangeRequest.js +58 -0
- package/{esm/components/workflow/components/AttributesChanges/types/DCRTypes.d.ts → cjs/components/workflow/types/dcrTypes.d.ts} +22 -16
- package/cjs/components/workflow/types/dcrTypes.js +2 -0
- package/esm/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +6 -11
- package/esm/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +7 -4
- package/esm/components/workflow/components/AttributesChanges/AttributesChanges.js +19 -9
- package/esm/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +4 -4
- package/esm/components/workflow/components/AttributesChanges/components/ChangeView/styles.js +3 -9
- package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.d.ts +2 -2
- package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.js +4 -1
- package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.d.ts +1 -0
- package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.js +10 -0
- package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.d.ts +2 -13
- package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.js +26 -10
- package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.d.ts +1 -1
- package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.js +14 -2
- package/esm/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +1 -1
- package/esm/components/workflow/components/AttributesChanges/helpers/attributesHelpers.d.ts +3 -2
- package/esm/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +35 -7
- package/esm/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +4 -6
- package/esm/components/workflow/components/AttributesChanges/helpers/helpers.js +4 -25
- package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +3 -2
- package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +112 -31
- package/esm/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.d.ts +3 -2
- package/esm/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.js +4 -4
- package/esm/components/workflow/components/AttributesChanges/types/diffTypes.d.ts +16 -0
- package/esm/components/workflow/components/AttributesChanges/types/{DCRTypes.js → diffTypes.js} +0 -0
- package/esm/components/workflow/components/LineDecorator/LineDecorator.d.ts +2 -1
- package/esm/components/workflow/components/LineDecorator/LineDecorator.js +5 -2
- package/esm/components/workflow/components/LineDecorator/styles.d.ts +1 -1
- package/esm/components/workflow/components/LineDecorator/styles.js +4 -1
- package/esm/components/workflow/{components/AttributesChanges/constants → constants}/operations.d.ts +0 -0
- package/esm/components/workflow/{components/AttributesChanges/constants → constants}/operations.js +0 -0
- package/esm/components/workflow/helpers/dcrHelpers.d.ts +7 -0
- package/esm/components/workflow/helpers/dcrHelpers.js +43 -0
- package/esm/components/workflow/hooks/useChangeRequest.d.ts +5 -0
- package/esm/components/workflow/hooks/useChangeRequest.js +54 -0
- package/{cjs/components/workflow/components/AttributesChanges/types/DCRTypes.d.ts → esm/components/workflow/types/dcrTypes.d.ts} +22 -16
- package/esm/components/workflow/types/dcrTypes.js +1 -0
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { Diff, Title } from '../../types/diffTypes';
|
|
3
3
|
declare type Props = {
|
|
4
|
-
changes:
|
|
4
|
+
changes: (Diff | Title)[];
|
|
5
5
|
};
|
|
6
6
|
declare const DCRChangesList: ({ changes }: Props) => JSX.Element;
|
|
7
7
|
export default DCRChangesList;
|
|
@@ -10,11 +10,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
|
+
import { has } from 'ramda';
|
|
13
14
|
import DiffRenderer from '../DiffRenderer/DiffRenderer';
|
|
15
|
+
import { useStyles } from './styles';
|
|
14
16
|
var DCRChangesList = function (_a) {
|
|
15
17
|
var changes = _a.changes;
|
|
18
|
+
var styles = useStyles();
|
|
16
19
|
return (React.createElement(React.Fragment, null, changes.map(function (change, index) {
|
|
17
|
-
return React.createElement(DiffRenderer, __assign({}, change, { key: index }));
|
|
20
|
+
return has('level', change) ? (React.createElement(DiffRenderer, __assign({}, change, { key: index }))) : (React.createElement("div", { className: styles.title, key: index }, change.label));
|
|
18
21
|
})));
|
|
19
22
|
};
|
|
20
23
|
export default DCRChangesList;
|
package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"title">;
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { ChangeValue, DCRAttributeValue } from '../../types/DCRTypes';
|
|
5
|
-
export declare type Props = {
|
|
6
|
-
level: number;
|
|
7
|
-
label: string;
|
|
8
|
-
attributeType: AttributeType;
|
|
9
|
-
attributeValue?: DCRAttributeValue;
|
|
10
|
-
newValue?: ChangeValue;
|
|
11
|
-
oldValue?: ChangeValue;
|
|
12
|
-
operation?: OperationTypes;
|
|
13
|
-
};
|
|
14
|
-
declare const DiffRenderer: ({ label, level, attributeType, attributeValue, oldValue, newValue, operation }: Props) => JSX.Element;
|
|
2
|
+
import { Diff } from '../../types/diffTypes';
|
|
3
|
+
declare const DiffRenderer: ({ label, level, attributeType, attributeValue, oldValue, newValue, operation }: Diff) => JSX.Element;
|
|
15
4
|
export default DiffRenderer;
|
package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.js
CHANGED
|
@@ -1,30 +1,46 @@
|
|
|
1
1
|
import React, { useCallback, useContext, useMemo } from 'react';
|
|
2
2
|
import { useSelector } from 'react-redux';
|
|
3
|
-
import { anyPass, ifElse, hasPath, path, when } from 'ramda';
|
|
3
|
+
import { anyPass, ifElse, isNil, hasPath, path, when } from 'ramda';
|
|
4
|
+
import classnames from 'classnames';
|
|
4
5
|
import { getAttributeValue, getLabel, isReference } from '@reltio/mdm-sdk';
|
|
5
6
|
import mdmModule from '@reltio/mdm-module';
|
|
6
7
|
import ChangeView from '../ChangeView/ChangeView';
|
|
7
|
-
import { getAttributeDescription, getDataTypeDefinition } from '../../helpers/helpers';
|
|
8
|
-
import EntityUriLink from '../../../../../EntityUriLink/EntityUriLink';
|
|
9
8
|
import { AttributesChangesContext } from '../../contexts/AttributesChangesContext';
|
|
9
|
+
import { getAttributeDescription, getDataTypeDefinition } from '../../helpers/helpers';
|
|
10
10
|
import DataTypeValue from '../../../../../DataTypeValue/DataTypeValue';
|
|
11
|
+
import EntityUriLink from '../../../../../EntityUriLink/EntityUriLink';
|
|
11
12
|
import { useStyles } from './styles';
|
|
12
13
|
var DiffRenderer = function (_a) {
|
|
13
14
|
var label = _a.label, level = _a.level, attributeType = _a.attributeType, attributeValue = _a.attributeValue, oldValue = _a.oldValue, newValue = _a.newValue, operation = _a.operation;
|
|
14
15
|
var styles = useStyles({ level: level });
|
|
15
|
-
var
|
|
16
|
+
var entityUri = useSelector(mdmModule.selectors.getEntityUri);
|
|
16
17
|
var objectsInfo = useContext(AttributesChangesContext);
|
|
17
|
-
var
|
|
18
|
+
var getLinkDescription = useCallback(function () {
|
|
18
19
|
if (isReference(attributeType)) {
|
|
19
20
|
var value = when(anyPass([hasPath(['value', 'newValue']), hasPath(['value', 'oldValue'])]), ifElse(hasPath(['value', 'newValue']), path(['value', 'newValue']), path(['value', 'oldValue'])))(attributeValue);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
return getAttributeDescription(attributeType, value, entityUri, objectsInfo);
|
|
22
|
+
}
|
|
23
|
+
else if ('endObject' in attributeType) {
|
|
24
|
+
var _a = attributeValue, endObjectUri = _a.endObjectUri, endObjectLabel = _a.endObjectLabel;
|
|
25
|
+
return {
|
|
26
|
+
objectUri: endObjectUri,
|
|
27
|
+
objectLabel: endObjectLabel
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}, [attributeType, attributeValue, entityUri, objectsInfo]);
|
|
31
|
+
var renderLink = useCallback(function () {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
var _c;
|
|
34
|
+
var _d = getLinkDescription() || {}, objectUri = _d.objectUri, objectLabel = _d.objectLabel;
|
|
35
|
+
if (!isNil(objectUri) && !isNil(objectLabel)) {
|
|
36
|
+
var isNotExist = ((_c = objectsInfo[objectUri]) === null || _c === void 0 ? void 0 : _c.isExist) === false;
|
|
37
|
+
return (React.createElement(EntityUriLink, { value: objectUri, className: classnames(styles.linkContainer, (_a = {}, _a[styles.disabledLink] = isNotExist, _a)) },
|
|
38
|
+
React.createElement("span", { className: classnames(styles.linkLabel, (_b = {}, _b[styles.label] = isNotExist, _b)) }, getLabel(objectLabel))));
|
|
23
39
|
}
|
|
24
40
|
return null;
|
|
25
|
-
}, [
|
|
41
|
+
}, [getLinkDescription, objectsInfo, styles]);
|
|
26
42
|
var changeLabel = useMemo(function () {
|
|
27
|
-
return (React.createElement("
|
|
43
|
+
return (React.createElement("span", null,
|
|
28
44
|
label,
|
|
29
45
|
renderLink()));
|
|
30
46
|
}, [label, renderLink]);
|
package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare type StylesProps = {
|
|
2
2
|
level: number;
|
|
3
3
|
};
|
|
4
|
-
export declare const useStyles: (props: StylesProps) => import("@material-ui/core/styles/withStyles").ClassNameMap<"
|
|
4
|
+
export declare const useStyles: (props: StylesProps) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "change" | "linkLabel" | "linkContainer" | "disabledLink">;
|
|
5
5
|
export {};
|
package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.js
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import { makeStyles } from '@material-ui/core/styles';
|
|
2
2
|
export var useStyles = makeStyles(function (theme) { return ({
|
|
3
|
-
|
|
4
|
-
color: theme.palette.primary.main,
|
|
3
|
+
linkContainer: {
|
|
5
4
|
textDecoration: 'none',
|
|
6
5
|
cursor: 'pointer',
|
|
7
6
|
marginLeft: '4px'
|
|
8
7
|
},
|
|
8
|
+
linkLabel: {
|
|
9
|
+
color: theme.palette.primary.main,
|
|
10
|
+
fontSize: '12px',
|
|
11
|
+
letterSpacing: 0,
|
|
12
|
+
lineHeight: '16px'
|
|
13
|
+
},
|
|
14
|
+
disabledLink: {
|
|
15
|
+
pointerEvents: 'none',
|
|
16
|
+
cursor: 'default'
|
|
17
|
+
},
|
|
18
|
+
label: {
|
|
19
|
+
color: theme.palette.text.primary
|
|
20
|
+
},
|
|
9
21
|
change: function (_a) {
|
|
10
22
|
var _b = _a.level, level = _b === void 0 ? 0 : _b;
|
|
11
23
|
return ({
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
|
|
1
|
+
declare const getEntityChanges: any;
|
|
2
|
+
declare const getRelationChanges: any;
|
|
3
|
+
export { getEntityChanges, getRelationChanges };
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { complement, curry, flatten, is, isEmpty, pathOr, propOr, times } from 'ramda';
|
|
13
|
+
import { DataTypes, getAttributeTypeSubAttributes, getLabel, getRelationAttributesList, getRelationType, isSpecialAttribute } from '@reltio/mdm-sdk';
|
|
3
14
|
import { getFilteredAttrTypes } from '../../../../attributes/helpers/attributesView';
|
|
4
15
|
import { getOperationType } from './helpers';
|
|
5
|
-
import { DCRTypes } from '
|
|
16
|
+
import { DCRTypes } from '../../../constants/operations';
|
|
6
17
|
var getValues = function (attributes, attrType) {
|
|
7
18
|
if ('newValue' in attributes || 'oldValue' in attributes) {
|
|
8
19
|
var newValue = attributes.newValue, oldValue = attributes.oldValue, type_1 = attributes.type;
|
|
@@ -21,10 +32,23 @@ var getValues = function (attributes, attrType) {
|
|
|
21
32
|
var values = attributes[attrType.name];
|
|
22
33
|
return values ? [values] : [];
|
|
23
34
|
};
|
|
24
|
-
var
|
|
25
|
-
var attrTypes = getFilteredAttrTypes(metadata,
|
|
35
|
+
var getEntityChanges = curry(function (metadata, entityInfo, changes) {
|
|
36
|
+
var attrTypes = getFilteredAttrTypes(metadata, entityInfo.type, [], []);
|
|
26
37
|
return getAttributesList(metadata, attrTypes, changes);
|
|
27
38
|
});
|
|
39
|
+
var getRelationChanges = curry(function (metadata, relationInfo, changes) {
|
|
40
|
+
var relationType = getRelationType(metadata, relationInfo.type);
|
|
41
|
+
var attrTypes = getRelationAttributesList(metadata, relationInfo.type);
|
|
42
|
+
return flatten([
|
|
43
|
+
{
|
|
44
|
+
level: 1,
|
|
45
|
+
label: propOr('', 'label', relationType),
|
|
46
|
+
attributeType: relationType,
|
|
47
|
+
attributeValue: __assign(__assign({}, relationInfo), changes)
|
|
48
|
+
},
|
|
49
|
+
getAttributesList(metadata, attrTypes, changes, 2)
|
|
50
|
+
]);
|
|
51
|
+
});
|
|
28
52
|
var getAttributesList = function (metadata, attrTypes, attributes, level) {
|
|
29
53
|
if (level === void 0) { level = 0; }
|
|
30
54
|
return flatten(attrTypes
|
|
@@ -37,6 +61,10 @@ var getAttributesList = function (metadata, attrTypes, attributes, level) {
|
|
|
37
61
|
})
|
|
38
62
|
.filter(complement(isEmpty)));
|
|
39
63
|
};
|
|
64
|
+
var getSimpleAttributeValue = function (attributeType, attributeValue) {
|
|
65
|
+
var value = isSpecialAttribute(attributeType) ? attributeValue : attributeValue.value;
|
|
66
|
+
return is(Object, value) ? value : { newValue: attributeValue, type: DCRTypes.INSERT_ATTRIBUTE };
|
|
67
|
+
};
|
|
40
68
|
var dcrAttributesFactory = function (metadata, attributeType, attributeValue, level) {
|
|
41
69
|
switch (attributeType.type) {
|
|
42
70
|
case DataTypes.TYPE_NESTED:
|
|
@@ -45,7 +73,7 @@ var dcrAttributesFactory = function (metadata, attributeType, attributeValue, le
|
|
|
45
73
|
case DataTypes.TYPE_REFERENCE:
|
|
46
74
|
return getReferenceAttributeChange(metadata, attributeType, attributeValue, level);
|
|
47
75
|
default: {
|
|
48
|
-
var value =
|
|
76
|
+
var value = getSimpleAttributeValue(attributeType, attributeValue);
|
|
49
77
|
return getSimpleAttributeChange(attributeType, value, level);
|
|
50
78
|
}
|
|
51
79
|
}
|
|
@@ -83,4 +111,4 @@ var getSimpleAttributeChange = function (attributeType, attributeValue, level) {
|
|
|
83
111
|
level: level
|
|
84
112
|
};
|
|
85
113
|
};
|
|
86
|
-
export {
|
|
114
|
+
export { getEntityChanges, getRelationChanges };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { AttributeType } from '@reltio/mdm-sdk';
|
|
2
|
-
import { OperationTypes } from '
|
|
3
|
-
import {
|
|
2
|
+
import { OperationTypes } from '../../../constants/operations';
|
|
3
|
+
import { DCRAttributeValue, DCRObjectsInfo, Value } from '../../../types/dcrTypes';
|
|
4
4
|
export declare const getOperationType: (type: string, oldValue?: DCRAttributeValue) => OperationTypes;
|
|
5
5
|
export declare const getOperationLabel: (operation: OperationTypes) => string;
|
|
6
6
|
export declare const getAttributeDescription: (attrType: AttributeType, value: DCRAttributeValue, currentEntityUri: string, objectsInfo?: DCRObjectsInfo) => {
|
|
7
|
-
objectUri:
|
|
8
|
-
objectLabel:
|
|
9
|
-
entityTypeUri: any;
|
|
7
|
+
objectUri: string;
|
|
8
|
+
objectLabel: string;
|
|
10
9
|
};
|
|
11
|
-
export declare const extractObjectsFromChangeRequest: ({ objectsInfo, changes }: ChangeRequest) => any;
|
|
12
10
|
export declare const getDataTypeDefinition: (attributeType: AttributeType, attributeValue: Value) => any;
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import i18n from 'ui-i18n';
|
|
13
|
-
import { allPass, always,
|
|
2
|
+
import { allPass, always, equals, evolve, pipe, prop, when } from 'ramda';
|
|
14
3
|
import { DataTypes, getAttrDataTypeDefinition, isUrl } from '@reltio/mdm-sdk';
|
|
15
|
-
import { DCRTypes, OperationTypes } from '
|
|
4
|
+
import { DCRTypes, OperationTypes } from '../../../constants/operations';
|
|
16
5
|
export var getOperationType = function (type, oldValue) {
|
|
17
6
|
switch (type) {
|
|
18
7
|
case DCRTypes.CREATE_RELATIONSHIP:
|
|
@@ -46,7 +35,7 @@ export var getOperationLabel = function (operation) {
|
|
|
46
35
|
};
|
|
47
36
|
export var getAttributeDescription = function (attrType, value, currentEntityUri, objectsInfo) {
|
|
48
37
|
if (objectsInfo === void 0) { objectsInfo = {}; }
|
|
49
|
-
var objectLabel, objectUri
|
|
38
|
+
var objectLabel, objectUri;
|
|
50
39
|
var relation = objectsInfo[value.refObjectURI];
|
|
51
40
|
if (relation) {
|
|
52
41
|
objectUri = currentEntityUri === relation.startObjectUri ? relation.endObjectUri : relation.startObjectUri;
|
|
@@ -57,21 +46,11 @@ export var getAttributeDescription = function (attrType, value, currentEntityUri
|
|
|
57
46
|
objectUri = value.refEntity.objectURI;
|
|
58
47
|
objectLabel = objectsInfo[objectUri].label;
|
|
59
48
|
}
|
|
60
|
-
if (objectUri && objectLabel) {
|
|
61
|
-
var objectInfo = objectsInfo[objectUri];
|
|
62
|
-
entityTypeUri = objectInfo ? objectInfo.type : attrType.referencedEntityTypeURI;
|
|
63
|
-
}
|
|
64
49
|
return {
|
|
65
50
|
objectUri: objectUri,
|
|
66
|
-
objectLabel: objectLabel
|
|
67
|
-
entityTypeUri: entityTypeUri
|
|
51
|
+
objectLabel: objectLabel
|
|
68
52
|
};
|
|
69
53
|
};
|
|
70
|
-
export var extractObjectsFromChangeRequest = function (_a) {
|
|
71
|
-
var _b = _a.objectsInfo, objectsInfo = _b === void 0 ? {} : _b, _c = _a.changes, changes = _c === void 0 ? {} : _c;
|
|
72
|
-
var getChange = function (key) { return prop([key], changes); };
|
|
73
|
-
return pipe(keys, filter(getChange), map(function (key) { return (__assign(__assign({}, objectsInfo[key]), { uri: key })); }))(objectsInfo);
|
|
74
|
-
};
|
|
75
54
|
export var getDataTypeDefinition = function (attributeType, attributeValue) {
|
|
76
55
|
return when(allPass([pipe(prop('type'), equals(DataTypes.TYPE_STRING)), function () { return isUrl(attributeValue); }]), evolve({ type: always(DataTypes.TYPE_URL) }))(getAttrDataTypeDefinition(attributeType));
|
|
77
56
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Metadata } from '@reltio/mdm-sdk';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { Diff } from '../types/diffTypes';
|
|
3
|
+
import { DCRChanges, EntityInfo, RelationInfo } from '../../../types/dcrTypes';
|
|
4
|
+
declare const mergeChanges: (metadata: Metadata, changes: DCRChanges, entityInfo: EntityInfo, relationsInfo: RelationInfo[]) => [Diff[], Diff[]];
|
|
4
5
|
export { mergeChanges };
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { concat, curry, difference, flatten, identity, isNil, omit, pick, pipe, propEq, propOr, reduce } from 'ramda';
|
|
13
|
+
import { EntityAttrTypes, generateTempUri, getRoleLabel, isEmptyValue } from '@reltio/mdm-sdk';
|
|
14
|
+
import { DCRTypes } from '../../../constants/operations';
|
|
15
|
+
import { getEntityChanges, getRelationChanges } from './attributesHelpers';
|
|
5
16
|
var ATTRIBUTE_DELIMITER = '/';
|
|
6
17
|
var SPECIAL_ATTRIBUTES_NAMES = [
|
|
7
18
|
'defaultProfilePicValue',
|
|
@@ -12,31 +23,37 @@ var SPECIAL_ATTRIBUTES_NAMES = [
|
|
|
12
23
|
];
|
|
13
24
|
var prepareStartOrEndDate = function (_a) {
|
|
14
25
|
var newValue = _a.newValue, oldValue = _a.oldValue;
|
|
15
|
-
var parseValue = function (value) { return (
|
|
26
|
+
var parseValue = function (value) { return (isNaN(value) ? value : parseInt(value)); };
|
|
16
27
|
var isExistedValue = function (value) { return (value === null || value === void 0 ? void 0 : value.length) && !isEmptyValue(value); };
|
|
17
28
|
var isExistNewValue = isExistedValue(newValue);
|
|
18
29
|
var isExistOldValue = isExistedValue(oldValue);
|
|
19
30
|
if (isExistNewValue && isExistOldValue) {
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
return [
|
|
32
|
+
{
|
|
33
|
+
type: DCRTypes.UPDATE_ATTRIBUTE,
|
|
34
|
+
oldValue: { value: parseValue(oldValue[0]) },
|
|
35
|
+
newValue: { value: parseValue(newValue[0]) }
|
|
36
|
+
}
|
|
37
|
+
];
|
|
25
38
|
}
|
|
26
39
|
else if (isExistNewValue) {
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
return [
|
|
41
|
+
{
|
|
42
|
+
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
43
|
+
newValue: { value: parseValue(newValue[0]) }
|
|
44
|
+
}
|
|
45
|
+
];
|
|
31
46
|
}
|
|
32
47
|
else if (isExistOldValue) {
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
type: DCRTypes.DELETE_ATTRIBUTE,
|
|
51
|
+
oldValue: { value: parseValue(oldValue[0]) }
|
|
52
|
+
}
|
|
53
|
+
];
|
|
37
54
|
}
|
|
38
55
|
};
|
|
39
|
-
var prepareRolesOrTags = function (
|
|
56
|
+
var prepareRolesOrTags = function (metadata, change) {
|
|
40
57
|
var _a = change.newValue, newValue = _a === void 0 ? [] : _a, _b = change.oldValue, oldValue = _b === void 0 ? [] : _b, type = change.type;
|
|
41
58
|
var getLabel = type === DCRTypes.UPDATE_ROLES ? getRoleLabel(metadata) : identity;
|
|
42
59
|
var diffNewValue = difference(newValue, oldValue);
|
|
@@ -88,6 +105,47 @@ var prepareAttribute = function (container, change) {
|
|
|
88
105
|
}
|
|
89
106
|
return container;
|
|
90
107
|
};
|
|
108
|
+
var createEntityOrRelation = function (metadata, value) {
|
|
109
|
+
var _a = value.attributes, attributes = _a === void 0 ? {} : _a, startDate = value.startDate, endDate = value.endDate;
|
|
110
|
+
var _b = value, roles = _b.roles, tags = _b.tags, defaultProfilePicValue = _b.defaultProfilePicValue;
|
|
111
|
+
var newObject = __assign({}, attributes);
|
|
112
|
+
if (defaultProfilePicValue) {
|
|
113
|
+
newObject['defaultProfilePicValue'] = [defaultProfilePicValue];
|
|
114
|
+
}
|
|
115
|
+
if (roles) {
|
|
116
|
+
newObject[EntityAttrTypes.roles.name] = [
|
|
117
|
+
{
|
|
118
|
+
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
119
|
+
newValue: { value: roles.map(getRoleLabel(metadata)).join(', ') }
|
|
120
|
+
}
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
if (tags) {
|
|
124
|
+
newObject[EntityAttrTypes.tags.name] = [
|
|
125
|
+
{
|
|
126
|
+
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
127
|
+
newValue: { value: tags.join(', ') }
|
|
128
|
+
}
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
if (startDate) {
|
|
132
|
+
newObject[EntityAttrTypes.startDate.name] = [
|
|
133
|
+
{
|
|
134
|
+
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
135
|
+
newValue: { value: startDate }
|
|
136
|
+
}
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
if (endDate) {
|
|
140
|
+
newObject[EntityAttrTypes.endDate.name] = [
|
|
141
|
+
{
|
|
142
|
+
type: DCRTypes.INSERT_ATTRIBUTE,
|
|
143
|
+
newValue: { value: endDate }
|
|
144
|
+
}
|
|
145
|
+
];
|
|
146
|
+
}
|
|
147
|
+
return newObject;
|
|
148
|
+
};
|
|
91
149
|
var mergeAttributesInChange = function (metadata, objectInfo, change, container) {
|
|
92
150
|
if (container === void 0) { container = {}; }
|
|
93
151
|
var type = change.type;
|
|
@@ -96,39 +154,62 @@ var mergeAttributesInChange = function (metadata, objectInfo, change, container)
|
|
|
96
154
|
container['defaultProfilePicValue'] = [change.newValue];
|
|
97
155
|
break;
|
|
98
156
|
case DCRTypes.UPDATE_TAGS:
|
|
99
|
-
container[EntityAttrTypes.tags.name] = prepareRolesOrTags(
|
|
157
|
+
container[EntityAttrTypes.tags.name] = prepareRolesOrTags(metadata, change);
|
|
100
158
|
break;
|
|
101
159
|
case DCRTypes.UPDATE_ROLES: {
|
|
102
|
-
container[EntityAttrTypes.roles.name] = prepareRolesOrTags(
|
|
160
|
+
container[EntityAttrTypes.roles.name] = prepareRolesOrTags(metadata, change);
|
|
103
161
|
break;
|
|
104
162
|
}
|
|
105
163
|
case DCRTypes.UPDATE_START_DATE:
|
|
106
|
-
container[EntityAttrTypes.startDate.name] =
|
|
164
|
+
container[EntityAttrTypes.startDate.name] = prepareStartOrEndDate(change);
|
|
107
165
|
break;
|
|
108
166
|
case DCRTypes.UPDATE_END_DATE:
|
|
109
|
-
container[EntityAttrTypes.endDate.name] =
|
|
167
|
+
container[EntityAttrTypes.endDate.name] = prepareStartOrEndDate(change);
|
|
110
168
|
break;
|
|
111
|
-
|
|
169
|
+
case DCRTypes.CREATE_RELATIONSHIP:
|
|
170
|
+
case DCRTypes.CREATE_ENTITY: {
|
|
171
|
+
return __assign(__assign({}, container), createEntityOrRelation(metadata, change.newValue));
|
|
172
|
+
}
|
|
173
|
+
case DCRTypes.INSERT_ATTRIBUTE:
|
|
174
|
+
case DCRTypes.UPDATE_ATTRIBUTE:
|
|
175
|
+
case DCRTypes.DELETE_ATTRIBUTE:
|
|
176
|
+
case DCRTypes.PIN_ATTRIBUTE:
|
|
177
|
+
case DCRTypes.IGNORE_ATTRIBUTE:
|
|
112
178
|
prepareAttribute(container, change);
|
|
113
179
|
break;
|
|
114
|
-
|
|
180
|
+
default:
|
|
181
|
+
break;
|
|
115
182
|
}
|
|
116
183
|
return container;
|
|
117
184
|
};
|
|
118
|
-
var
|
|
119
|
-
var
|
|
185
|
+
var updateRelation = function (metadata, changes, relationInfo) {
|
|
186
|
+
var relationChanges = propOr([], relationInfo.uri)(changes);
|
|
187
|
+
return relationChanges.reduce(function (result, change) {
|
|
188
|
+
return mergeAttributesInChange(metadata, relationInfo, change, result);
|
|
189
|
+
}, {});
|
|
190
|
+
};
|
|
191
|
+
var mergeChanges = function (metadata, changes, entityInfo, relationsInfo) {
|
|
192
|
+
var getAttributeChanges = function (attributeName) {
|
|
193
|
+
return pipe(pick([attributeName]), getEntityChanges(metadata, entityInfo));
|
|
194
|
+
};
|
|
120
195
|
var concatChanges = curry(function (getters, attributesTree) {
|
|
121
196
|
return reduce(function (acc, getter) { return concat(acc, getter(attributesTree)); }, [], getters);
|
|
122
197
|
});
|
|
123
|
-
var
|
|
124
|
-
|
|
198
|
+
var entityInfoChanges = propOr([], entityInfo.uri)(changes);
|
|
199
|
+
var changesTree = entityInfoChanges.reduce(function (result, change) {
|
|
200
|
+
return mergeAttributesInChange(metadata, entityInfo, change, result);
|
|
125
201
|
}, {});
|
|
126
|
-
return
|
|
127
|
-
|
|
202
|
+
var relationsTrees = relationsInfo.map(function (relationInfo) { return updateRelation(metadata, changes, relationInfo); });
|
|
203
|
+
var entityChanges = concatChanges([
|
|
204
|
+
pipe(omit(SPECIAL_ATTRIBUTES_NAMES), getEntityChanges(metadata, entityInfo)),
|
|
128
205
|
getAttributeChanges(EntityAttrTypes.roles.name),
|
|
129
206
|
getAttributeChanges(EntityAttrTypes.tags.name),
|
|
130
207
|
getAttributeChanges(EntityAttrTypes.startDate.name),
|
|
131
208
|
getAttributeChanges(EntityAttrTypes.endDate.name)
|
|
132
209
|
], changesTree);
|
|
210
|
+
var relationsChanges = flatten(relationsInfo.map(function (relationInfo, index) {
|
|
211
|
+
return getRelationChanges(metadata, relationInfo, relationsTrees[index]);
|
|
212
|
+
}));
|
|
213
|
+
return [entityChanges, relationsChanges];
|
|
133
214
|
};
|
|
134
215
|
export { mergeChanges };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { Diff, Title } from '../types/diffTypes';
|
|
2
|
+
export declare const useCollapsibleList: (items: (Diff | Title)[], limit?: number) => {
|
|
2
3
|
isExpanded: boolean;
|
|
3
4
|
onToggle: () => void;
|
|
4
|
-
itemsToShow:
|
|
5
|
+
itemsToShow: (Diff | Title)[];
|
|
5
6
|
collapsedSuggestionsCount: number;
|
|
6
7
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useCallback, useMemo, useState } from 'react';
|
|
2
2
|
import { getSuggestionsCount } from '../helpers/contextHelpers';
|
|
3
3
|
var DEFAULT_VISIBLE_ITEMS_COUNT = 3;
|
|
4
|
-
export var useCollapsibleList = function (
|
|
4
|
+
export var useCollapsibleList = function (items, limit) {
|
|
5
5
|
if (limit === void 0) { limit = DEFAULT_VISIBLE_ITEMS_COUNT; }
|
|
6
6
|
var _a = useState(false), isExpanded = _a[0], setIsExpanded = _a[1];
|
|
7
7
|
var onToggle = useCallback(function () { return setIsExpanded(function (value) { return !value; }); }, []);
|
|
8
|
-
var collapsedItems = useMemo(function () { return
|
|
9
|
-
var suggestionsCount = useMemo(function () { return getSuggestionsCount(
|
|
8
|
+
var collapsedItems = useMemo(function () { return items.slice(0, limit); }, [items, limit]);
|
|
9
|
+
var suggestionsCount = useMemo(function () { return getSuggestionsCount(items); }, [items]);
|
|
10
10
|
var visibleSuggestionsCount = useMemo(function () { return getSuggestionsCount(collapsedItems); }, [collapsedItems]);
|
|
11
|
-
var itemsToShow = isExpanded ?
|
|
11
|
+
var itemsToShow = isExpanded ? items : collapsedItems;
|
|
12
12
|
var collapsedSuggestionsCount = suggestionsCount - visibleSuggestionsCount;
|
|
13
13
|
return { isExpanded: isExpanded, onToggle: onToggle, itemsToShow: itemsToShow, collapsedSuggestionsCount: collapsedSuggestionsCount };
|
|
14
14
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AttributeType } from '@reltio/mdm-sdk';
|
|
2
|
+
import { ChangeValue, DCRAttributeValue, RelationInfo } from '../../../types/dcrTypes';
|
|
3
|
+
import { OperationTypes } from '../../../constants/operations';
|
|
4
|
+
export declare type RelationAttributeValue = DCRAttributeValue & RelationInfo;
|
|
5
|
+
export declare type Diff = {
|
|
6
|
+
level: number;
|
|
7
|
+
label: string;
|
|
8
|
+
attributeType: AttributeType;
|
|
9
|
+
attributeValue?: DCRAttributeValue | RelationAttributeValue;
|
|
10
|
+
newValue?: ChangeValue;
|
|
11
|
+
oldValue?: ChangeValue;
|
|
12
|
+
operation?: OperationTypes;
|
|
13
|
+
};
|
|
14
|
+
export declare type Title = {
|
|
15
|
+
label: string;
|
|
16
|
+
};
|
package/esm/components/workflow/components/AttributesChanges/types/{DCRTypes.js → diffTypes.js}
RENAMED
|
File without changes
|
|
@@ -6,6 +6,7 @@ declare type Props = {
|
|
|
6
6
|
first?: boolean;
|
|
7
7
|
last?: boolean;
|
|
8
8
|
transparent?: boolean;
|
|
9
|
+
divider?: boolean;
|
|
9
10
|
};
|
|
10
|
-
declare const LineDecorator: ({ className, children, plain, first, last, transparent }: Props) => JSX.Element;
|
|
11
|
+
declare const LineDecorator: ({ className, children, plain, first, last, transparent, divider }: Props) => JSX.Element;
|
|
11
12
|
export default LineDecorator;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { useStyles } from './styles';
|
|
4
|
+
import Divider from '@material-ui/core/Divider';
|
|
4
5
|
var LineDecorator = function (_a) {
|
|
5
6
|
var _b, _c, _d;
|
|
6
|
-
var className = _a.className, children = _a.children, plain = _a.plain, first = _a.first, last = _a.last, transparent = _a.transparent;
|
|
7
|
+
var className = _a.className, children = _a.children, plain = _a.plain, first = _a.first, last = _a.last, transparent = _a.transparent, divider = _a.divider;
|
|
7
8
|
var styles = useStyles();
|
|
8
9
|
return (React.createElement("div", { className: classnames(className, styles.decorator) },
|
|
9
10
|
React.createElement("div", { className: classnames(styles.lineBlock, (_b = {}, _b[styles.withLinePadding] = first, _b)) }, !transparent && (React.createElement(React.Fragment, null,
|
|
10
11
|
React.createElement("div", { className: styles.noLine }),
|
|
11
12
|
React.createElement("div", { className: classnames(styles.line, (_c = {}, _c[styles.plain] = plain, _c), (_d = {}, _d[styles.last] = last, _d)) })))),
|
|
12
|
-
React.createElement("div", { className: styles.content },
|
|
13
|
+
React.createElement("div", { className: styles.content },
|
|
14
|
+
children,
|
|
15
|
+
divider && React.createElement(Divider, { className: styles.rowDivider, light: true, variant: "inset" }))));
|
|
13
16
|
};
|
|
14
17
|
export default LineDecorator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"content" | "last" | "line" | "decorator" | "plain" | "lineBlock" | "withLinePadding" | "noLine">;
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"content" | "last" | "line" | "rowDivider" | "decorator" | "plain" | "lineBlock" | "withLinePadding" | "noLine">;
|
package/esm/components/workflow/{components/AttributesChanges/constants → constants}/operations.d.ts
RENAMED
|
File without changes
|
package/esm/components/workflow/{components/AttributesChanges/constants → constants}/operations.js
RENAMED
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GroupedObjectsInfo, DCRChanges, DCRObjectInfo, DCRObjectsInfo } from '../types/dcrTypes';
|
|
2
|
+
export declare const getEntitiesObjects: any;
|
|
3
|
+
export declare const getRelationsObjects: any;
|
|
4
|
+
export declare const extractObjectsFromChangeRequest: (changes: DCRChanges, objectsInfo: DCRObjectsInfo) => DCRObjectInfo[];
|
|
5
|
+
export declare const createEntityRelationsObjectByEntity: any;
|
|
6
|
+
export declare const createEntityRelationsObjectByRelation: any;
|
|
7
|
+
export declare const concatEntityRelationsObjects: (acc: Record<string, GroupedObjectsInfo>, object: GroupedObjectsInfo) => Record<string, GroupedObjectsInfo>;
|