@reltio/components 1.4.908 → 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.
Files changed (151) hide show
  1. package/cjs/components/ActionButton/ActionButton.d.ts +16 -0
  2. package/cjs/components/ActionButton/ActionButton.js +90 -0
  3. package/cjs/components/ActionButton/styles.d.ts +1 -0
  4. package/cjs/components/ActionButton/styles.js +50 -0
  5. package/cjs/components/MergeButton/MergeButton.d.ts +15 -0
  6. package/cjs/components/MergeButton/MergeButton.js +64 -0
  7. package/cjs/components/NotMatchButton/NotMatchButton.d.ts +15 -0
  8. package/cjs/components/NotMatchButton/NotMatchButton.js +64 -0
  9. package/cjs/components/ProfileMatchCard/ProfileMatchCard.d.ts +2 -1
  10. package/cjs/components/ProfileMatchCard/ProfileMatchCard.js +3 -2
  11. package/cjs/components/attributes/AttributesView/AttributesView.d.ts +1 -1
  12. package/cjs/components/attributes/AttributesView/AttributesView.js +2 -2
  13. package/cjs/components/attributes/AttributesView/index.d.ts +1 -1
  14. package/cjs/components/attributes/editMode/AttributesList/AttributesList.js +3 -1
  15. package/cjs/components/attributes/editMode/AttributesPager/AttributeRenderer.js +4 -1
  16. package/cjs/components/attributes/editMode/AttributesView/AttributesView.d.ts +1 -1
  17. package/cjs/components/attributes/editMode/AttributesView/AttributesView.js +9 -2
  18. package/cjs/components/attributes/editMode/AttributesView/index.d.ts +9 -1
  19. package/cjs/components/attributes/editMode/contexts/PinnedAttributesContext.d.ts +2 -0
  20. package/cjs/components/attributes/editMode/contexts/PinnedAttributesContext.js +8 -0
  21. package/cjs/components/attributes/readMode/AttributesView/index.d.ts +8 -0
  22. package/cjs/components/attributes/types/attributesView.d.ts +4 -0
  23. package/cjs/components/history/HistoryMenuButton/HistoryMenuButton.js +46 -1
  24. package/cjs/components/history/HistoryMenuButton/MenuItemRenderer.d.ts +12 -0
  25. package/cjs/components/history/HistoryMenuButton/MenuItemRenderer.js +44 -0
  26. package/cjs/components/history/HistoryMenuButton/styles.d.ts +1 -1
  27. package/cjs/components/history/HistoryMenuButton/styles.js +13 -0
  28. package/cjs/components/index.d.ts +3 -0
  29. package/cjs/components/index.js +8 -1
  30. package/cjs/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +6 -30
  31. package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +7 -4
  32. package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.js +19 -9
  33. package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +4 -4
  34. package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/styles.js +3 -9
  35. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.d.ts +2 -2
  36. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.js +4 -1
  37. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.d.ts +1 -0
  38. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.js +13 -0
  39. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.d.ts +2 -13
  40. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.js +25 -9
  41. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.d.ts +1 -1
  42. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.js +14 -2
  43. package/cjs/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +1 -1
  44. package/cjs/components/workflow/components/AttributesChanges/helpers/attributesHelpers.d.ts +3 -2
  45. package/cjs/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +35 -6
  46. package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +4 -6
  47. package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.js +4 -26
  48. package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +3 -2
  49. package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +109 -28
  50. package/cjs/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.d.ts +3 -2
  51. package/cjs/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.js +4 -4
  52. package/cjs/components/workflow/components/AttributesChanges/types/diffTypes.d.ts +16 -0
  53. package/cjs/components/workflow/components/AttributesChanges/types/{DCRTypes.js → diffTypes.js} +0 -0
  54. package/cjs/components/workflow/components/LineDecorator/LineDecorator.d.ts +2 -1
  55. package/cjs/components/workflow/components/LineDecorator/LineDecorator.js +5 -2
  56. package/cjs/components/workflow/components/LineDecorator/styles.d.ts +1 -1
  57. package/cjs/components/workflow/components/LineDecorator/styles.js +4 -1
  58. package/cjs/components/workflow/{components/AttributesChanges/constants → constants}/operations.d.ts +0 -0
  59. package/cjs/components/workflow/{components/AttributesChanges/constants → constants}/operations.js +0 -0
  60. package/cjs/components/workflow/helpers/dcrHelpers.d.ts +7 -0
  61. package/cjs/components/workflow/helpers/dcrHelpers.js +48 -0
  62. package/cjs/components/workflow/hooks/useChangeRequest.d.ts +5 -0
  63. package/cjs/components/workflow/hooks/useChangeRequest.js +58 -0
  64. package/{esm/components/workflow/components/AttributesChanges/types/DCRTypes.d.ts → cjs/components/workflow/types/dcrTypes.d.ts} +22 -16
  65. package/cjs/components/workflow/types/dcrTypes.js +2 -0
  66. package/cjs/contexts/CollaborationContext/index.d.ts +1 -0
  67. package/cjs/contexts/CollaborationContext/index.js +1 -0
  68. package/cjs/hooks/index.d.ts +2 -0
  69. package/cjs/hooks/index.js +5 -1
  70. package/cjs/hooks/useCollaboration.d.ts +11 -10
  71. package/cjs/hooks/useCollaboration.js +24 -15
  72. package/cjs/hooks/useMarkAsNotMatchRequest.d.ts +12 -0
  73. package/cjs/hooks/useMarkAsNotMatchRequest.js +29 -0
  74. package/cjs/hooks/useMergeAllRequest.d.ts +12 -0
  75. package/cjs/hooks/useMergeAllRequest.js +29 -0
  76. package/esm/components/ActionButton/ActionButton.d.ts +16 -0
  77. package/esm/components/ActionButton/ActionButton.js +65 -0
  78. package/esm/components/ActionButton/styles.d.ts +1 -0
  79. package/esm/components/ActionButton/styles.js +47 -0
  80. package/esm/components/MergeButton/MergeButton.d.ts +15 -0
  81. package/esm/components/MergeButton/MergeButton.js +39 -0
  82. package/esm/components/NotMatchButton/NotMatchButton.d.ts +15 -0
  83. package/esm/components/NotMatchButton/NotMatchButton.js +39 -0
  84. package/esm/components/ProfileMatchCard/ProfileMatchCard.d.ts +2 -1
  85. package/esm/components/ProfileMatchCard/ProfileMatchCard.js +3 -2
  86. package/esm/components/attributes/AttributesView/AttributesView.d.ts +1 -1
  87. package/esm/components/attributes/AttributesView/AttributesView.js +2 -2
  88. package/esm/components/attributes/AttributesView/index.d.ts +1 -1
  89. package/esm/components/attributes/editMode/AttributesList/AttributesList.js +4 -2
  90. package/esm/components/attributes/editMode/AttributesPager/AttributeRenderer.js +5 -2
  91. package/esm/components/attributes/editMode/AttributesView/AttributesView.d.ts +1 -1
  92. package/esm/components/attributes/editMode/AttributesView/AttributesView.js +10 -3
  93. package/esm/components/attributes/editMode/AttributesView/index.d.ts +9 -1
  94. package/esm/components/attributes/editMode/contexts/PinnedAttributesContext.d.ts +2 -0
  95. package/esm/components/attributes/editMode/contexts/PinnedAttributesContext.js +2 -0
  96. package/esm/components/attributes/readMode/AttributesView/index.d.ts +8 -0
  97. package/esm/components/attributes/types/attributesView.d.ts +4 -0
  98. package/esm/components/history/HistoryMenuButton/HistoryMenuButton.js +27 -1
  99. package/esm/components/history/HistoryMenuButton/MenuItemRenderer.d.ts +12 -0
  100. package/esm/components/history/HistoryMenuButton/MenuItemRenderer.js +20 -0
  101. package/esm/components/history/HistoryMenuButton/styles.d.ts +1 -1
  102. package/esm/components/history/HistoryMenuButton/styles.js +13 -0
  103. package/esm/components/index.d.ts +3 -0
  104. package/esm/components/index.js +3 -0
  105. package/esm/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +6 -11
  106. package/esm/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +7 -4
  107. package/esm/components/workflow/components/AttributesChanges/AttributesChanges.js +19 -9
  108. package/esm/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +4 -4
  109. package/esm/components/workflow/components/AttributesChanges/components/ChangeView/styles.js +3 -9
  110. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.d.ts +2 -2
  111. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.js +4 -1
  112. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.d.ts +1 -0
  113. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.js +10 -0
  114. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.d.ts +2 -13
  115. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.js +26 -10
  116. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.d.ts +1 -1
  117. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.js +14 -2
  118. package/esm/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +1 -1
  119. package/esm/components/workflow/components/AttributesChanges/helpers/attributesHelpers.d.ts +3 -2
  120. package/esm/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +35 -7
  121. package/esm/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +4 -6
  122. package/esm/components/workflow/components/AttributesChanges/helpers/helpers.js +4 -25
  123. package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +3 -2
  124. package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +112 -31
  125. package/esm/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.d.ts +3 -2
  126. package/esm/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.js +4 -4
  127. package/esm/components/workflow/components/AttributesChanges/types/diffTypes.d.ts +16 -0
  128. package/esm/components/workflow/components/AttributesChanges/types/{DCRTypes.js → diffTypes.js} +0 -0
  129. package/esm/components/workflow/components/LineDecorator/LineDecorator.d.ts +2 -1
  130. package/esm/components/workflow/components/LineDecorator/LineDecorator.js +5 -2
  131. package/esm/components/workflow/components/LineDecorator/styles.d.ts +1 -1
  132. package/esm/components/workflow/components/LineDecorator/styles.js +4 -1
  133. package/esm/components/workflow/{components/AttributesChanges/constants → constants}/operations.d.ts +0 -0
  134. package/esm/components/workflow/{components/AttributesChanges/constants → constants}/operations.js +0 -0
  135. package/esm/components/workflow/helpers/dcrHelpers.d.ts +7 -0
  136. package/esm/components/workflow/helpers/dcrHelpers.js +43 -0
  137. package/esm/components/workflow/hooks/useChangeRequest.d.ts +5 -0
  138. package/esm/components/workflow/hooks/useChangeRequest.js +54 -0
  139. package/{cjs/components/workflow/components/AttributesChanges/types/DCRTypes.d.ts → esm/components/workflow/types/dcrTypes.d.ts} +22 -16
  140. package/esm/components/workflow/types/dcrTypes.js +1 -0
  141. package/esm/contexts/CollaborationContext/index.d.ts +1 -0
  142. package/esm/contexts/CollaborationContext/index.js +1 -0
  143. package/esm/hooks/index.d.ts +2 -0
  144. package/esm/hooks/index.js +2 -0
  145. package/esm/hooks/useCollaboration.d.ts +11 -10
  146. package/esm/hooks/useCollaboration.js +25 -16
  147. package/esm/hooks/useMarkAsNotMatchRequest.d.ts +12 -0
  148. package/esm/hooks/useMarkAsNotMatchRequest.js +22 -0
  149. package/esm/hooks/useMergeAllRequest.d.ts +12 -0
  150. package/esm/hooks/useMergeAllRequest.js +22 -0
  151. package/package.json +3 -3
@@ -1 +1 @@
1
- export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"icon">;
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"icon" | "menuItem" | "menuText" | "checkIcon">;
@@ -2,5 +2,18 @@ import { makeStyles } from '@material-ui/core/styles';
2
2
  export var useStyles = makeStyles({
3
3
  icon: {
4
4
  margin: 5
5
+ },
6
+ menuItem: {
7
+ minHeight: '32px'
8
+ },
9
+ menuText: {
10
+ fontSize: '13px',
11
+ lineHeight: '15px',
12
+ letterSpacing: 0,
13
+ marginLeft: '30px'
14
+ },
15
+ checkIcon: {
16
+ position: 'absolute',
17
+ color: 'rgba(0, 0, 0, 0.54)'
5
18
  }
6
19
  });
@@ -122,3 +122,6 @@ export { default as OvIcon } from './attributes/OvIcon';
122
122
  export { default as RelationEditor } from './RelationEditor';
123
123
  export * from './workflow';
124
124
  export { ProfileMatchCard } from './ProfileMatchCard/ProfileMatchCard';
125
+ export { MergeButton } from './MergeButton/MergeButton';
126
+ export { NotMatchButton } from './NotMatchButton/NotMatchButton';
127
+ export { ActionButton, ActionButtonMode } from './ActionButton/ActionButton';
@@ -121,3 +121,6 @@ export { default as OvIcon } from './attributes/OvIcon';
121
121
  export { default as RelationEditor } from './RelationEditor';
122
122
  export * from './workflow';
123
123
  export { ProfileMatchCard } from './ProfileMatchCard/ProfileMatchCard';
124
+ export { MergeButton } from './MergeButton/MergeButton';
125
+ export { NotMatchButton } from './NotMatchButton/NotMatchButton';
126
+ export { ActionButton, ActionButtonMode } from './ActionButton/ActionButton';
@@ -1,22 +1,17 @@
1
- import React, { useState, useEffect, useMemo } from 'react';
2
- import { getDataChangeRequest } from '@reltio/mdm-sdk';
1
+ import React from 'react';
3
2
  import GenericWorkflowTaskCard from '../GenericWorkflowTaskCard/GenericWorkflowTaskCard';
4
3
  import LineDecorator from '../../components/LineDecorator/LineDecorator';
5
4
  import { getDCRUri } from '../../helpers';
6
5
  import DcrTaskIcon from '../../../../icons/DcrTaskIcon';
7
- import { AttributesChangesContext } from '../../components/AttributesChanges/contexts/AttributesChangesContext';
8
- import { extractObjectsFromChangeRequest } from '../../components/AttributesChanges/helpers/helpers';
9
6
  import AttributesChanges from '../../components/AttributesChanges/AttributesChanges';
7
+ import { useChangeRequest } from '../../hooks/useChangeRequest';
10
8
  var DataChangeRequestTaskCard = function (_a) {
11
9
  var task = _a.task;
12
10
  var objectURIs = task.objectURIs;
13
11
  var dcrUri = getDCRUri(objectURIs);
14
- var _b = useState(null), dcr = _b[0], setDcr = _b[1];
15
- useEffect(function () {
16
- getDataChangeRequest(dcrUri).then(setDcr);
17
- }, [dcrUri]);
18
- var objectsWithChanges = useMemo(function () { return (dcr ? extractObjectsFromChangeRequest(dcr) : []); }, [dcr]);
19
- return (React.createElement(GenericWorkflowTaskCard, { task: task, Icon: DcrTaskIcon }, dcr && (React.createElement(AttributesChangesContext.Provider, { value: dcr.objectsInfo },
20
- React.createElement(LineDecorator, { last: true }, objectsWithChanges.map(function (object) { return (React.createElement(AttributesChanges, { key: object.uri, changes: dcr.changes[object.uri], objectInfo: object })); }))))));
12
+ var _b = useChangeRequest(dcrUri), dcr = _b.dcr, groupedObjects = _b.groupedObjects;
13
+ return (React.createElement(GenericWorkflowTaskCard, { task: task, Icon: DcrTaskIcon }, dcr &&
14
+ groupedObjects.map(function (object, index) { return (React.createElement(LineDecorator, { key: index, last: index === groupedObjects.length - 1, divider: true },
15
+ React.createElement(AttributesChanges, { entityInfo: object.entity, relationsInfo: object.relations, changes: dcr.changes, objectsInfo: dcr.objectsInfo }))); })));
21
16
  };
22
17
  export default DataChangeRequestTaskCard;
@@ -1,8 +1,11 @@
1
1
  /// <reference types="react" />
2
- import { DCRChange, EntityInfo } from './types/DCRTypes';
2
+ import { DCRChanges, DCRObjectsInfo, EntityInfo, RelationInfo } from '../../types/dcrTypes';
3
3
  declare type Props = {
4
- changes: DCRChange[];
5
- objectInfo: EntityInfo;
4
+ changes: DCRChanges;
5
+ objectsInfo: DCRObjectsInfo;
6
+ entityInfo: EntityInfo;
7
+ relationsInfo?: RelationInfo[];
8
+ max?: number;
6
9
  };
7
- declare const AttributesChanges: ({ changes, objectInfo }: Props) => JSX.Element;
10
+ declare const AttributesChanges: ({ changes, objectsInfo, entityInfo, relationsInfo, max }: Props) => JSX.Element;
8
11
  export default AttributesChanges;
@@ -1,23 +1,33 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { useSelector } from 'react-redux';
3
+ import i18n from 'ui-i18n';
4
+ import { flatten } from 'ramda';
3
5
  import mdmModule from '@reltio/mdm-module';
4
6
  import { getEntityUriForLink, getLabel } from '@reltio/mdm-sdk';
5
7
  import { mergeChanges } from './helpers/mergeHelpers';
6
- import EntityUriLink from '../../../EntityUriLink/EntityUriLink';
7
8
  import ShowMoreLink from './components/ShowMoreLink/ShowMoreLink';
8
9
  import DCRChangesList from './components/DCRChangesList/DCRChangesList';
10
+ import { AttributesChangesContext } from './contexts/AttributesChangesContext';
9
11
  import { useCollapsibleList } from './hooks/useCollapsibleList';
12
+ import EntityUriLink from '../../../EntityUriLink/EntityUriLink';
10
13
  import { useStyles } from './styles';
11
14
  var AttributesChanges = function (_a) {
12
- var changes = _a.changes, objectInfo = _a.objectInfo;
15
+ var changes = _a.changes, objectsInfo = _a.objectsInfo, entityInfo = _a.entityInfo, relationsInfo = _a.relationsInfo, max = _a.max;
13
16
  var styles = useStyles();
14
17
  var metadata = useSelector(mdmModule.selectors.getMetadata);
15
- var mergedChanges = useMemo(function () { return mergeChanges(metadata, changes, objectInfo); }, [metadata, changes, objectInfo]);
16
- var _b = useCollapsibleList(mergedChanges), isExpanded = _b.isExpanded, onToggle = _b.onToggle, itemsToShow = _b.itemsToShow, collapsedSuggestionsCount = _b.collapsedSuggestionsCount;
17
- return (React.createElement("div", { className: styles.container },
18
- React.createElement(EntityUriLink, { className: styles.uri, value: getEntityUriForLink(objectInfo) },
19
- React.createElement("div", { className: styles.label }, getLabel(objectInfo.label))),
20
- React.createElement(DCRChangesList, { changes: itemsToShow }),
21
- collapsedSuggestionsCount > 0 && (React.createElement(ShowMoreLink, { onClick: onToggle, suggestionsCount: collapsedSuggestionsCount, isExpanded: isExpanded, className: styles.showMoreLink }))));
18
+ var _b = useMemo(function () { return mergeChanges(metadata, changes, entityInfo, relationsInfo); }, [metadata, changes, entityInfo, relationsInfo]), mergedEntityChanges = _b[0], mergedRelationsChanges = _b[1];
19
+ var changesList = useMemo(function () {
20
+ var relationshipTitle = { label: i18n.text('Relationships') };
21
+ return mergedRelationsChanges.length > 0
22
+ ? flatten([mergedEntityChanges, relationshipTitle, mergedRelationsChanges])
23
+ : mergedEntityChanges;
24
+ }, [mergedEntityChanges, mergedRelationsChanges]);
25
+ var _c = useCollapsibleList(changesList, max), isExpanded = _c.isExpanded, onToggle = _c.onToggle, itemsToShow = _c.itemsToShow, collapsedSuggestionsCount = _c.collapsedSuggestionsCount;
26
+ return (React.createElement(AttributesChangesContext.Provider, { value: objectsInfo },
27
+ React.createElement("div", { className: styles.container },
28
+ React.createElement(EntityUriLink, { className: styles.uri, value: getEntityUriForLink(entityInfo) },
29
+ React.createElement("div", { className: styles.label }, getLabel(entityInfo.label))),
30
+ React.createElement(DCRChangesList, { changes: itemsToShow }),
31
+ collapsedSuggestionsCount > 0 && (React.createElement(ShowMoreLink, { onClick: onToggle, suggestionsCount: collapsedSuggestionsCount, isExpanded: isExpanded, className: styles.showMoreLink })))));
22
32
  };
23
33
  export default AttributesChanges;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import { OperationTypes } from '../../constants/operations';
2
+ import { OperationTypes } from '../../../../constants/operations';
3
3
  declare type Props = {
4
- label: React.ReactElement;
5
- oldValue?: React.ReactElement;
6
- newValue?: React.ReactElement;
4
+ label: React.ReactNode;
5
+ oldValue?: React.ReactNode;
6
+ newValue?: React.ReactNode;
7
7
  operation?: OperationTypes;
8
8
  className?: string;
9
9
  };
@@ -5,20 +5,15 @@ export var useStyles = makeStyles(function (theme) { return ({
5
5
  lineHeight: '20px',
6
6
  color: theme.palette.text.primary,
7
7
  marginTop: '6px',
8
- display: 'flex',
9
- flexWrap: 'wrap',
10
- overflow: 'hidden'
8
+ overflow: 'hidden',
9
+ wordBreak: 'break-word'
11
10
  },
12
11
  fieldName: {
13
- display: 'flex',
14
- alignItems: 'center',
15
12
  color: theme.palette.text.secondary,
16
13
  marginRight: '8px'
17
14
  },
18
15
  difference: {
19
- display: 'flex',
20
- alignItems: 'center',
21
- flexDirection: 'row'
16
+ marginRight: '8px'
22
17
  },
23
18
  arrow: {
24
19
  margin: '0 4px',
@@ -31,7 +26,6 @@ export var useStyles = makeStyles(function (theme) { return ({
31
26
  fontWeight: 500,
32
27
  lineHeight: '16px',
33
28
  letterSpacing: 0,
34
- marginLeft: '8px',
35
29
  flexShrink: 0,
36
30
  textTransform: 'capitalize',
37
31
  color: theme.palette.primary.main,
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { Props as Change } from '../DiffRenderer/DiffRenderer';
2
+ import { Diff, Title } from '../../types/diffTypes';
3
3
  declare type Props = {
4
- changes: Change[];
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;
@@ -0,0 +1 @@
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"title">;
@@ -0,0 +1,10 @@
1
+ import { makeStyles } from '@material-ui/core/styles';
2
+ export var useStyles = makeStyles({
3
+ title: {
4
+ fontSize: '12px',
5
+ letterSpacing: 0,
6
+ lineHeight: '16px',
7
+ fontWeight: 500,
8
+ marginTop: '8px'
9
+ }
10
+ });
@@ -1,15 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { AttributeType } from '@reltio/mdm-sdk';
3
- import { OperationTypes } from '../../constants/operations';
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;
@@ -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 entity = useSelector(mdmModule.selectors.getEntity);
16
+ var entityUri = useSelector(mdmModule.selectors.getEntityUri);
16
17
  var objectsInfo = useContext(AttributesChangesContext);
17
- var renderLink = useCallback(function () {
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
- var _a = getAttributeDescription(attributeType, value, entity.uri, objectsInfo), objectUri = _a.objectUri, objectLabel = _a.objectLabel;
21
- return (React.createElement(EntityUriLink, { value: objectUri, className: styles.uri },
22
- React.createElement("span", null, getLabel(objectLabel))));
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
- }, [attributeType, attributeValue, entity.uri, objectsInfo, styles.uri]);
41
+ }, [getLinkDescription, objectsInfo, styles]);
26
42
  var changeLabel = useMemo(function () {
27
- return (React.createElement("div", null,
43
+ return (React.createElement("span", null,
28
44
  label,
29
45
  renderLink()));
30
46
  }, [label, renderLink]);
@@ -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<"uri" | "change">;
4
+ export declare const useStyles: (props: StylesProps) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "change" | "linkLabel" | "linkContainer" | "disabledLink">;
5
5
  export {};
@@ -1,11 +1,23 @@
1
1
  import { makeStyles } from '@material-ui/core/styles';
2
2
  export var useStyles = makeStyles(function (theme) { return ({
3
- uri: {
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,3 +1,3 @@
1
1
  import React from 'react';
2
- import { DCRObjectsInfo } from '../types/DCRTypes';
2
+ import { DCRObjectsInfo } from '../../../types/dcrTypes';
3
3
  export declare const AttributesChangesContext: React.Context<DCRObjectsInfo>;
@@ -1,2 +1,3 @@
1
- declare const getChanges: any;
2
- export { getChanges };
1
+ declare const getEntityChanges: any;
2
+ declare const getRelationChanges: any;
3
+ export { getEntityChanges, getRelationChanges };
@@ -1,8 +1,19 @@
1
- import { complement, curry, flatten, isEmpty, pathOr, times } from 'ramda';
2
- import { DataTypes, getAttributeTypeSubAttributes, getLabel, isSpecialAttribute } from '@reltio/mdm-sdk';
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 '../constants/operations';
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 getChanges = curry(function (metadata, objectInfo, changes) {
25
- var attrTypes = getFilteredAttrTypes(metadata, objectInfo.type, [], []);
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 = isSpecialAttribute(attributeType) ? attributeValue : attributeValue.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 { getChanges };
114
+ export { getEntityChanges, getRelationChanges };
@@ -1,12 +1,10 @@
1
1
  import { AttributeType } from '@reltio/mdm-sdk';
2
- import { OperationTypes } from '../constants/operations';
3
- import { ChangeRequest, DCRAttributeValue, DCRObjectsInfo, Value } from '../types/DCRTypes';
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: any;
8
- objectLabel: any;
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, evolve, equals, filter, keys, map, prop, pipe, when } from 'ramda';
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 '../constants/operations';
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, entityTypeUri;
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 { DCRChange, DCRObjectInfo } from '../types/DCRTypes';
3
- declare const mergeChanges: (metadata: Metadata, changes: DCRChange[], objectInfo: DCRObjectInfo) => any;
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 };