@reltio/components 1.4.911 → 1.4.915

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 (103) hide show
  1. package/cjs/components/MergeButton/MergeButton.d.ts +1 -0
  2. package/cjs/components/MergeButton/MergeButton.js +3 -2
  3. package/cjs/components/attributes/ImageAttributesLine/ImageAttributesLine.d.ts +7 -2
  4. package/cjs/components/attributes/ImageAttributesLine/ImageAttributesLine.js +15 -1
  5. package/cjs/components/attributes/editMode/AttributesPager/AttributesPager.js +1 -1
  6. package/cjs/components/attributes/editMode/ImageAttributesLine/ImageAttributesLine.d.ts +8 -2
  7. package/cjs/components/attributes/editMode/ImageAttributesLine/ImageAttributesLine.js +5 -5
  8. package/cjs/components/attributes/editMode/SimpleAttributeEditor/selectors/helpers/parents.js +3 -1
  9. package/cjs/components/attributes/readMode/AttributesPager/AttributesPager.js +1 -1
  10. package/cjs/components/attributes/readMode/ImageAttributesLine/ImageAttributesLine.d.ts +7 -2
  11. package/cjs/components/attributes/readMode/ImageAttributesLine/ImageAttributesLine.js +2 -2
  12. package/cjs/components/index.d.ts +1 -0
  13. package/cjs/components/index.js +5 -3
  14. package/cjs/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +6 -30
  15. package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +7 -4
  16. package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.js +19 -9
  17. package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +4 -4
  18. package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/styles.js +3 -9
  19. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.d.ts +2 -2
  20. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.js +4 -1
  21. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.d.ts +1 -0
  22. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.js +13 -0
  23. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.d.ts +2 -13
  24. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.js +25 -9
  25. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.d.ts +1 -1
  26. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.js +14 -2
  27. package/cjs/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +1 -1
  28. package/cjs/components/workflow/components/AttributesChanges/helpers/attributesHelpers.d.ts +3 -2
  29. package/cjs/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +35 -6
  30. package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +4 -6
  31. package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.js +4 -26
  32. package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +3 -2
  33. package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +109 -28
  34. package/cjs/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.d.ts +3 -2
  35. package/cjs/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.js +4 -4
  36. package/cjs/components/workflow/components/AttributesChanges/types/diffTypes.d.ts +16 -0
  37. package/cjs/components/workflow/components/AttributesChanges/types/{DCRTypes.js → diffTypes.js} +0 -0
  38. package/cjs/components/workflow/components/LineDecorator/LineDecorator.d.ts +2 -1
  39. package/cjs/components/workflow/components/LineDecorator/LineDecorator.js +5 -2
  40. package/cjs/components/workflow/components/LineDecorator/styles.d.ts +1 -1
  41. package/cjs/components/workflow/components/LineDecorator/styles.js +4 -1
  42. package/cjs/components/workflow/{components/AttributesChanges/constants → constants}/operations.d.ts +0 -0
  43. package/cjs/components/workflow/{components/AttributesChanges/constants → constants}/operations.js +0 -0
  44. package/cjs/components/workflow/helpers/dcrHelpers.d.ts +7 -0
  45. package/cjs/components/workflow/helpers/dcrHelpers.js +48 -0
  46. package/cjs/components/workflow/hooks/useChangeRequest.d.ts +5 -0
  47. package/cjs/components/workflow/hooks/useChangeRequest.js +58 -0
  48. package/{esm/components/workflow/components/AttributesChanges/types/DCRTypes.d.ts → cjs/components/workflow/types/dcrTypes.d.ts} +22 -16
  49. package/cjs/components/workflow/types/dcrTypes.js +2 -0
  50. package/cjs/hooks/useMergeAllRequest.d.ts +2 -1
  51. package/cjs/hooks/useMergeAllRequest.js +6 -3
  52. package/esm/components/MergeButton/MergeButton.d.ts +1 -0
  53. package/esm/components/MergeButton/MergeButton.js +3 -2
  54. package/esm/components/attributes/ImageAttributesLine/ImageAttributesLine.d.ts +7 -2
  55. package/esm/components/attributes/ImageAttributesLine/ImageAttributesLine.js +15 -1
  56. package/esm/components/attributes/editMode/AttributesPager/AttributesPager.js +1 -1
  57. package/esm/components/attributes/editMode/ImageAttributesLine/ImageAttributesLine.d.ts +8 -2
  58. package/esm/components/attributes/editMode/ImageAttributesLine/ImageAttributesLine.js +6 -6
  59. package/esm/components/attributes/editMode/SimpleAttributeEditor/selectors/helpers/parents.js +3 -1
  60. package/esm/components/attributes/readMode/AttributesPager/AttributesPager.js +1 -1
  61. package/esm/components/attributes/readMode/ImageAttributesLine/ImageAttributesLine.d.ts +7 -2
  62. package/esm/components/attributes/readMode/ImageAttributesLine/ImageAttributesLine.js +2 -2
  63. package/esm/components/index.d.ts +1 -0
  64. package/esm/components/index.js +1 -0
  65. package/esm/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +6 -11
  66. package/esm/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +7 -4
  67. package/esm/components/workflow/components/AttributesChanges/AttributesChanges.js +19 -9
  68. package/esm/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +4 -4
  69. package/esm/components/workflow/components/AttributesChanges/components/ChangeView/styles.js +3 -9
  70. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.d.ts +2 -2
  71. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.js +4 -1
  72. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.d.ts +1 -0
  73. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.js +10 -0
  74. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.d.ts +2 -13
  75. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.js +26 -10
  76. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.d.ts +1 -1
  77. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.js +14 -2
  78. package/esm/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +1 -1
  79. package/esm/components/workflow/components/AttributesChanges/helpers/attributesHelpers.d.ts +3 -2
  80. package/esm/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +35 -7
  81. package/esm/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +4 -6
  82. package/esm/components/workflow/components/AttributesChanges/helpers/helpers.js +4 -25
  83. package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +3 -2
  84. package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +112 -31
  85. package/esm/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.d.ts +3 -2
  86. package/esm/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.js +4 -4
  87. package/esm/components/workflow/components/AttributesChanges/types/diffTypes.d.ts +16 -0
  88. package/esm/components/workflow/components/AttributesChanges/types/{DCRTypes.js → diffTypes.js} +0 -0
  89. package/esm/components/workflow/components/LineDecorator/LineDecorator.d.ts +2 -1
  90. package/esm/components/workflow/components/LineDecorator/LineDecorator.js +5 -2
  91. package/esm/components/workflow/components/LineDecorator/styles.d.ts +1 -1
  92. package/esm/components/workflow/components/LineDecorator/styles.js +4 -1
  93. package/esm/components/workflow/{components/AttributesChanges/constants → constants}/operations.d.ts +0 -0
  94. package/esm/components/workflow/{components/AttributesChanges/constants → constants}/operations.js +0 -0
  95. package/esm/components/workflow/helpers/dcrHelpers.d.ts +7 -0
  96. package/esm/components/workflow/helpers/dcrHelpers.js +43 -0
  97. package/esm/components/workflow/hooks/useChangeRequest.d.ts +5 -0
  98. package/esm/components/workflow/hooks/useChangeRequest.js +54 -0
  99. package/{cjs/components/workflow/components/AttributesChanges/types/DCRTypes.d.ts → esm/components/workflow/types/dcrTypes.d.ts} +22 -16
  100. package/esm/components/workflow/types/dcrTypes.js +1 -0
  101. package/esm/hooks/useMergeAllRequest.d.ts +2 -1
  102. package/esm/hooks/useMergeAllRequest.js +6 -3
  103. package/package.json +3 -3
@@ -1,10 +1,26 @@
1
- import { Crosswalk, NestedAttributeValue, ReferenceAttributeValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
1
+ import { Crosswalk, Entity, NestedAttributeValue, ReferenceAttributeValue, Relation, SimpleAttributeValue } from '@reltio/mdm-sdk';
2
2
  import { DCRTypes } from '../constants/operations';
3
+ export declare type ChangeRequest = {
4
+ changes: DCRChanges;
5
+ createdBy: string;
6
+ createdTime: number;
7
+ objectsInfo: DCRObjectsInfo;
8
+ state: string;
9
+ type: string;
10
+ updatedBy: string;
11
+ updatedTime: number;
12
+ uri: string;
13
+ };
14
+ export declare type GroupedObjectsInfo = {
15
+ entity: EntityInfo;
16
+ relations: RelationInfo[];
17
+ };
3
18
  export declare type EntityInfo = {
4
19
  isExist: boolean;
5
20
  label: string;
6
21
  secondaryLabel: string;
7
22
  type: string;
23
+ uri?: string;
8
24
  };
9
25
  export declare type RelationInfo = {
10
26
  type: string;
@@ -13,11 +29,15 @@ export declare type RelationInfo = {
13
29
  endObjectLabel: string;
14
30
  endObjectUri: string;
15
31
  isExist: boolean;
32
+ uri?: string;
16
33
  };
17
34
  export declare type DCRObjectInfo = EntityInfo | RelationInfo;
18
35
  export declare type DCRObjectsInfo = {
19
36
  [key: string]: DCRObjectInfo;
20
37
  };
38
+ export declare type DCRAttributes = {
39
+ [attributeName: string]: (ChangeValue | DCRChange)[];
40
+ };
21
41
  export declare type Value = DCRAttributes | DCRChange | string | boolean | number;
22
42
  export declare type DCRAttributeValue = Omit<SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue, 'uri' | 'value'> & {
23
43
  value: Value;
@@ -27,10 +47,7 @@ export declare type DCRAttributeValue = Omit<SimpleAttributeValue | NestedAttrib
27
47
  };
28
48
  uri?: string;
29
49
  };
30
- export declare type DCRAttributes = {
31
- [attributeName: string]: DCRAttributeValue[];
32
- };
33
- export declare type ChangeValue = DCRAttributeValue | string[];
50
+ export declare type ChangeValue = DCRAttributeValue | string[] | Entity | Relation;
34
51
  export declare type DCRChange = {
35
52
  attributePath?: string;
36
53
  attributeType?: string;
@@ -50,14 +67,3 @@ export declare type DCRChange = {
50
67
  export declare type DCRChanges = {
51
68
  [key: string]: DCRChange[];
52
69
  };
53
- export declare type ChangeRequest = {
54
- changes: DCRChanges;
55
- createdBy: string;
56
- createdTime: number;
57
- objectsInfo: DCRObjectsInfo;
58
- state: string;
59
- type: string;
60
- updatedBy: string;
61
- updatedTime: number;
62
- uri: string;
63
- };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -4,8 +4,9 @@ declare type Props = {
4
4
  entity: Entity;
5
5
  onFinishRequest?: () => void;
6
6
  onStartRequest?: () => void;
7
+ onError?: () => void;
7
8
  };
8
- export declare const useMergeAllRequest: ({ entities, entity, onFinishRequest, onStartRequest }: Props) => {
9
+ export declare const useMergeAllRequest: ({ entities, entity, onFinishRequest, onStartRequest, onError }: Props) => {
9
10
  isPending: boolean;
10
11
  sendMergeAllRequest: () => void;
11
12
  };
@@ -8,18 +8,21 @@ var react_1 = require("react");
8
8
  var react_redux_1 = require("react-redux");
9
9
  var mdm_module_1 = __importDefault(require("@reltio/mdm-module"));
10
10
  var mdm_sdk_1 = require("@reltio/mdm-sdk");
11
+ var core_1 = require("../core");
11
12
  var useMergeAllRequest = function (_a) {
12
- var entities = _a.entities, entity = _a.entity, onFinishRequest = _a.onFinishRequest, onStartRequest = _a.onStartRequest;
13
+ var entities = _a.entities, entity = _a.entity, onFinishRequest = _a.onFinishRequest, onStartRequest = _a.onStartRequest, _b = _a.onError, onError = _b === void 0 ? core_1.noop : _b;
13
14
  var tenant = react_redux_1.useSelector(mdm_module_1.default.selectors.getTenant);
14
15
  var dtssPath = react_redux_1.useSelector(mdm_module_1.default.selectors.getDtssPath);
15
- var _b = react_1.useState(false), isPending = _b[0], setIsPending = _b[1];
16
+ var _c = react_1.useState(false), isPending = _c[0], setIsPending = _c[1];
16
17
  var sendMergeAllRequest = react_1.useCallback(function () {
17
18
  onStartRequest === null || onStartRequest === void 0 ? void 0 : onStartRequest();
18
19
  setIsPending(true);
19
20
  var params = { dtssPath: dtssPath, customerTenant: tenant, entity: entity, entities: entities };
20
21
  (mdm_sdk_1.isDataTenantEntity(entity)
21
22
  ? mdm_sdk_1.mergeDataTenantEntity(params)
22
- : mdm_sdk_1.mergeCustomerTenantEntityWithMixedEntities(params)).finally(function () {
23
+ : mdm_sdk_1.mergeCustomerTenantEntityWithMixedEntities(params))
24
+ .catch(onError)
25
+ .finally(function () {
23
26
  onFinishRequest === null || onFinishRequest === void 0 ? void 0 : onFinishRequest();
24
27
  setIsPending(false);
25
28
  });
@@ -10,6 +10,7 @@ declare type Props = {
10
10
  disabled?: boolean;
11
11
  onStartRequest?: () => void;
12
12
  onFinishRequest?: () => void;
13
+ onError?: () => void;
13
14
  };
14
15
  export declare const MergeButton: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLLIElement>>;
15
16
  export {};
@@ -27,12 +27,13 @@ import { noop } from '../../core';
27
27
  import { ActionButton, ActionButtonMode } from '../ActionButton/ActionButton';
28
28
  import { useMergeAllRequest } from '../../hooks';
29
29
  export var MergeButton = forwardRef(function (_a, ref) {
30
- var className = _a.className, _b = _a.mode, mode = _b === void 0 ? ActionButtonMode.iconButton : _b, _c = _a.onMenuClose, onMenuClose = _c === void 0 ? noop : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, entity = _a.entity, entities = _a.entities, onStartRequest = _a.onStartRequest, onFinishRequest = _a.onFinishRequest, otherProps = __rest(_a, ["className", "mode", "onMenuClose", "disabled", "entity", "entities", "onStartRequest", "onFinishRequest"]);
30
+ var className = _a.className, _b = _a.mode, mode = _b === void 0 ? ActionButtonMode.iconButton : _b, _c = _a.onMenuClose, onMenuClose = _c === void 0 ? noop : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, entity = _a.entity, entities = _a.entities, onStartRequest = _a.onStartRequest, onFinishRequest = _a.onFinishRequest, onError = _a.onError, otherProps = __rest(_a, ["className", "mode", "onMenuClose", "disabled", "entity", "entities", "onStartRequest", "onFinishRequest", "onError"]);
31
31
  var sendMergeAllRequest = useMergeAllRequest({
32
32
  entity: entity,
33
33
  entities: entities,
34
34
  onStartRequest: onStartRequest,
35
- onFinishRequest: onFinishRequest
35
+ onFinishRequest: onFinishRequest,
36
+ onError: onError
36
37
  }).sendMergeAllRequest;
37
38
  return (React.createElement(ActionButton, __assign({ className: className, disabled: disabled, mode: mode, label: i18n.text('Merge'), icon: MergeIcon, onClick: sendMergeAllRequest, onMenuClose: onMenuClose, ref: ref }, otherProps)));
38
39
  });
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- import { AttributeType, ImageAttributeValue } from '@reltio/mdm-sdk';
2
+ import { RequestNextPageOfAttributeValuesPayload } from '@reltio/mdm-module';
3
+ import { AttributeType, ImageAttributeValue, Paging } from '@reltio/mdm-sdk';
3
4
  import { AttributeItem } from '../editMode/AttributesPager';
4
5
  import { SIZES_TYPE } from './styles';
5
6
  export declare type ImageRenderProps = {
@@ -19,6 +20,10 @@ declare type Props = {
19
20
  onUpload?: () => void;
20
21
  onDeleteAttribute?: (param: AttributeItem) => void;
21
22
  imageSize?: SIZES_TYPE;
23
+ paging?: Paging;
24
+ requestNextPageOfAttributeValues?: (payload: RequestNextPageOfAttributeValuesPayload) => void;
25
+ parentUri?: string;
26
+ showNonOv?: boolean;
22
27
  };
23
- declare const ImageAttributesLine: ({ attributeType, attributeValues, renderImage, overlay, countFixedItems, children, onUpload, onDeleteAttribute, imageSize }: Props) => JSX.Element;
28
+ declare const ImageAttributesLine: ({ attributeType, attributeValues, renderImage, overlay, countFixedItems, children, onUpload, onDeleteAttribute, imageSize, paging, parentUri, showNonOv, requestNextPageOfAttributeValues }: Props) => JSX.Element;
24
29
  export default ImageAttributesLine;
@@ -21,11 +21,25 @@ import { downloadImagesByURLs } from '../helpers/imageAttributes';
21
21
  import { DEFAULT_IMAGE_SIZE, IMAGE_MIN_VISIBLE_WIDTH } from './constants';
22
22
  import { useStyles } from './styles';
23
23
  var ImageAttributesLine = function (_a) {
24
- var attributeType = _a.attributeType, _b = _a.attributeValues, attributeValues = _b === void 0 ? [] : _b, renderImage = _a.renderImage, _c = _a.overlay, overlay = _c === void 0 ? false : _c, _d = _a.countFixedItems, countFixedItems = _d === void 0 ? 0 : _d, children = _a.children, onUpload = _a.onUpload, onDeleteAttribute = _a.onDeleteAttribute, _e = _a.imageSize, imageSize = _e === void 0 ? DEFAULT_IMAGE_SIZE : _e;
24
+ var attributeType = _a.attributeType, _b = _a.attributeValues, attributeValues = _b === void 0 ? [] : _b, renderImage = _a.renderImage, _c = _a.overlay, overlay = _c === void 0 ? false : _c, _d = _a.countFixedItems, countFixedItems = _d === void 0 ? 0 : _d, children = _a.children, onUpload = _a.onUpload, onDeleteAttribute = _a.onDeleteAttribute, _e = _a.imageSize, imageSize = _e === void 0 ? DEFAULT_IMAGE_SIZE : _e, paging = _a.paging, parentUri = _a.parentUri, showNonOv = _a.showNonOv, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues;
25
25
  var entity = useSelector(mdm.selectors.getEntity) || {};
26
26
  var isViewMode = useSelector(mdm.selectors.getIsViewMode);
27
27
  var dispatch = useDispatch();
28
28
  var styles = useStyles(imageSize);
29
+ useEffect(function () {
30
+ if (paging && requestNextPageOfAttributeValues) {
31
+ var totalVisibleValues = showNonOv ? paging.totalOvValues : paging.totalValues;
32
+ if (totalVisibleValues > attributeValues.length) {
33
+ requestNextPageOfAttributeValues({
34
+ parentUri: parentUri,
35
+ attributeTypeUri: attributeType.uri,
36
+ attributeTypeName: attributeType.name,
37
+ values: [],
38
+ defaultMaxValues: totalVisibleValues
39
+ });
40
+ }
41
+ }
42
+ }, [paging, requestNextPageOfAttributeValues, attributeType, parentUri, attributeValues.length, showNonOv]);
29
43
  var lastWidth = useRef();
30
44
  var _f = useState(0), maxItems = _f[0], setMaxItems = _f[1];
31
45
  var _g = useState(0), hiddenItemsLength = _g[0], setHiddenItemsLength = _g[1];
@@ -56,7 +56,7 @@ var AttributesPager = function (_a) {
56
56
  return (React.createElement(BranchDecorator, { enabled: drawLines },
57
57
  React.createElement("div", { className: styles.wrapper },
58
58
  React.createElement(Title, { label: attributeType === null || attributeType === void 0 ? void 0 : attributeType.label, attributeType: attributeType }),
59
- React.createElement(ImageAttributesLine, { attributeValues: visibleValues, attributeType: attributeType, onDeleteAttribute: onDeleteAttribute, parentUri: parentUri, onChangeAttribute: onChangeAttribute }))));
59
+ React.createElement(ImageAttributesLine, { attributeValues: visibleValues, attributeType: attributeType, paging: paging, onDeleteAttribute: onDeleteAttribute, parentUri: parentUri, onChangeAttribute: onChangeAttribute, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv }))));
60
60
  default:
61
61
  return (React.createElement(AttributeRenderer, __assign({ values: visibleValues, attributeType: attributeType, max: max, paging: paging, crosswalks: crosswalks, showEmptyEditors: showEmptyEditors, drawLines: drawLines, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv }, commonProps)));
62
62
  }
@@ -1,12 +1,18 @@
1
1
  /// <reference types="react" />
2
- import { AttributeType, ImageAttributeValue } from '@reltio/mdm-sdk';
2
+ import { RequestNextPageOfAttributeValuesPayload } from '@reltio/mdm-module';
3
+ import { AttributeType, ImageAttributeValue, Paging } from '@reltio/mdm-sdk';
3
4
  import { AttributeItem } from '../AttributesPager';
5
+ import { SIZES_TYPE } from '../../ImageAttributesLine/styles';
4
6
  declare type Props = {
5
7
  attributeType: AttributeType;
6
8
  attributeValues: ImageAttributeValue[];
7
9
  onDeleteAttribute: (param: AttributeItem) => void;
8
10
  onChangeAttribute: (param: AttributeItem) => void;
9
11
  parentUri: string;
12
+ imageSize?: SIZES_TYPE;
13
+ paging?: Paging;
14
+ requestNextPageOfAttributeValues?: (payload: RequestNextPageOfAttributeValuesPayload) => void;
15
+ showNonOv?: boolean;
10
16
  };
11
- declare const ImageAttributesLine: ({ attributeType, attributeValues, onDeleteAttribute, onChangeAttribute, parentUri }: Props) => JSX.Element;
17
+ declare const ImageAttributesLine: ({ attributeType, attributeValues, onDeleteAttribute, onChangeAttribute, requestNextPageOfAttributeValues, parentUri, paging, showNonOv, imageSize }: Props) => JSX.Element;
12
18
  export default ImageAttributesLine;
@@ -8,17 +8,17 @@ import ImageActionsOverlay from '../../../Image/ImageActionsOverlay/ImageActions
8
8
  import { SmallIconButton } from '../../../SmallIconButton';
9
9
  import { UploadImageDialog } from '../../../UploadImageDialog/UploadImageDialog';
10
10
  import ImageAttributesLineCommon from '../../ImageAttributesLine';
11
- import { IMAGE_HEIGHT, IMAGE_MARGIN, IMAGE_WIDTH } from '../../ImageAttributesLine/constants';
11
+ import { DEFAULT_IMAGE_SIZE } from '../../ImageAttributesLine/constants';
12
12
  import { useStyles } from './styles';
13
13
  var ImageAttributesLine = function (_a) {
14
- var _b = _a.attributeType, attributeType = _b === void 0 ? {} : _b, _c = _a.attributeValues, attributeValues = _c === void 0 ? [] : _c, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, parentUri = _a.parentUri;
15
- var styles = useStyles({ imageMargin: IMAGE_MARGIN, imageWidth: IMAGE_WIDTH, imageHeight: IMAGE_HEIGHT });
14
+ var _b = _a.attributeType, attributeType = _b === void 0 ? {} : _b, _c = _a.attributeValues, attributeValues = _c === void 0 ? [] : _c, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues, parentUri = _a.parentUri, paging = _a.paging, showNonOv = _a.showNonOv, _d = _a.imageSize, imageSize = _d === void 0 ? DEFAULT_IMAGE_SIZE : _d;
15
+ var styles = useStyles(imageSize);
16
16
  var entity = useSelector(mdmModule.selectors.getEntity) || {};
17
17
  var defaultProfilePic = useSelector(function (state) {
18
18
  return mdmModule.selectors.getModifiedEntityDefaultProfilePic(state, entity.uri);
19
19
  });
20
20
  var dispatch = useDispatch();
21
- var _d = useState(false), isVisibleUploadDialog = _d[0], setIsVisibleUploadDialog = _d[1];
21
+ var _e = useState(false), isVisibleUploadDialog = _e[0], setIsVisibleUploadDialog = _e[1];
22
22
  var toggleVisibilityUploadDialog = useCallback(function () {
23
23
  setIsVisibleUploadDialog(function (visible) { return !visible; });
24
24
  }, []);
@@ -70,12 +70,12 @@ var ImageAttributesLine = function (_a) {
70
70
  var uri = attribute.uri;
71
71
  var onOpenImageGalleryDialog = methods.onOpenImageGalleryDialog;
72
72
  return (React.createElement("div", { className: styles.image, key: uri },
73
- React.createElement(Image, { src: src, overlay: renderImageActionsOverlay(methods, attribute), onClick: function () { return onOpenImageGalleryDialog(uri); } })));
73
+ React.createElement(Image, { src: src, overlay: renderImageActionsOverlay(methods, attribute), onClick: function () { return onOpenImageGalleryDialog(uri); }, size: { imageWidth: imageSize.imageWidth, imageHeight: imageSize.imageHeight } })));
74
74
  };
75
75
  return renderImage;
76
76
  };
77
77
  return (React.createElement("div", { className: styles.root },
78
- React.createElement(ImageAttributesLineCommon, { attributeValues: attributeValues, attributeType: attributeType, renderImage: renderImage, overlay: true, countFixedItems: 1, onUpload: toggleVisibilityUploadDialog, onDeleteAttribute: handleDeleteAttribute },
78
+ React.createElement(ImageAttributesLineCommon, { attributeValues: attributeValues, attributeType: attributeType, renderImage: renderImage, overlay: true, countFixedItems: 1, onUpload: toggleVisibilityUploadDialog, onDeleteAttribute: handleDeleteAttribute, imageSize: imageSize, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, paging: paging, parentUri: parentUri, showNonOv: showNonOv },
79
79
  React.createElement("div", { className: styles.uploadContainer, onClick: toggleVisibilityUploadDialog },
80
80
  React.createElement(SmallIconButton, { className: styles.uploadButton, iconClassName: styles.uploadIcon, icon: CloudUploadIcon }))),
81
81
  React.createElement(UploadImageDialog, { open: isVisibleUploadDialog, onUpload: handleAddAttributes, onClose: toggleVisibilityUploadDialog })));
@@ -24,11 +24,13 @@ export var getParents = function (state, valueUri, node) {
24
24
  });
25
25
  var modifiedEntities = mdmModule.selectors.getModifiedEntities(state);
26
26
  var entityUri = mdmModule.selectors.getEntityUri(state);
27
+ var connections = mdmModule.selectors.getAllRelationsToAddAndEdit(state);
27
28
  var ownParentNodesValues = filterRelatedParentValuesForDependentLookupValueUri({
28
29
  parentValues: parentNodesValues,
29
30
  valueUri: valueUri,
30
31
  entityUri: entityUri,
31
- modifiedEntities: modifiedEntities
32
+ modifiedEntities: modifiedEntities,
33
+ connections: connections
32
34
  });
33
35
  var neededParentsAttributeTypes = node.parents.map(function (type) {
34
36
  var parentNode = mdmModule.selectors.getDependentLookupsStructureNode(state, type);
@@ -47,7 +47,7 @@ var AttributesPager = function (_a) {
47
47
  case RENDERER_TYPES.imageLine:
48
48
  return (React.createElement(React.Fragment, null,
49
49
  showTitle && React.createElement(Title, { label: attributeType === null || attributeType === void 0 ? void 0 : attributeType.label, attributeType: attributeType }),
50
- React.createElement(ImageAttributesLine, { attributeValues: visibleValues, attributeType: attributeType })));
50
+ React.createElement(ImageAttributesLine, { attributeValues: visibleValues, attributeType: attributeType, paging: paging, parentUri: parentUri, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv })));
51
51
  case RENDERER_TYPES.special:
52
52
  return React.createElement(SpecialRenderer, { values: visibleValues, attributeType: attributeType, showTitle: showTitle });
53
53
  }
@@ -1,10 +1,15 @@
1
1
  /// <reference types="react" />
2
- import { AttributeType, ImageAttributeValue } from '@reltio/mdm-sdk';
2
+ import { AttributeType, ImageAttributeValue, Paging } from '@reltio/mdm-sdk';
3
+ import { RequestNextPageOfAttributeValuesPayload } from '@reltio/mdm-module';
3
4
  import { SIZES_TYPE } from '../../ImageAttributesLine/styles';
4
5
  declare type Props = {
5
6
  attributeValues: ImageAttributeValue[];
6
7
  attributeType: AttributeType;
7
8
  imageSize?: SIZES_TYPE;
9
+ paging?: Paging;
10
+ parentUri?: string;
11
+ showNonOv?: boolean;
12
+ requestNextPageOfAttributeValues?: (payload: RequestNextPageOfAttributeValuesPayload) => void;
8
13
  };
9
- declare const ImageAttributesLine: ({ attributeType, attributeValues, imageSize }: Props) => JSX.Element;
14
+ declare const ImageAttributesLine: ({ attributeType, attributeValues, paging, parentUri, requestNextPageOfAttributeValues, showNonOv, imageSize }: Props) => JSX.Element;
10
15
  export default ImageAttributesLine;
@@ -8,7 +8,7 @@ import { DEFAULT_IMAGE_SIZE } from '../../ImageAttributesLine/constants';
8
8
  import { getHistoryAppearanceByUri, getHistoryAttributeClassName } from '../helpers/historyAppearance';
9
9
  import { useStyles } from './styles';
10
10
  var ImageAttributesLine = function (_a) {
11
- var attributeType = _a.attributeType, _b = _a.attributeValues, attributeValues = _b === void 0 ? [] : _b, _c = _a.imageSize, imageSize = _c === void 0 ? DEFAULT_IMAGE_SIZE : _c;
11
+ var attributeType = _a.attributeType, _b = _a.attributeValues, attributeValues = _b === void 0 ? [] : _b, paging = _a.paging, parentUri = _a.parentUri, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues, showNonOv = _a.showNonOv, _c = _a.imageSize, imageSize = _c === void 0 ? DEFAULT_IMAGE_SIZE : _c;
12
12
  var styles = useStyles(imageSize);
13
13
  var appearance = useContext(HistoryDiffContext).appearance;
14
14
  var renderImage = function (_a) {
@@ -26,6 +26,6 @@ var ImageAttributesLine = function (_a) {
26
26
  };
27
27
  return renderImage;
28
28
  };
29
- return (React.createElement(ImageAttributesLineCommon, { attributeValues: attributeValues, attributeType: attributeType, renderImage: renderImage, imageSize: imageSize }));
29
+ return (React.createElement(ImageAttributesLineCommon, { attributeValues: attributeValues, attributeType: attributeType, renderImage: renderImage, imageSize: imageSize, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, paging: paging, parentUri: parentUri, showNonOv: showNonOv }));
30
30
  };
31
31
  export default ImageAttributesLine;
@@ -17,6 +17,7 @@ export { default as EditableAttribute } from './attributes/editMode/AttributesFa
17
17
  export { default as ReadOnlyAttributeValuesBlock } from './attributes/readMode/AttributeValuesBlock/AttributeValuesBlock';
18
18
  export { default as ReadOnlyAttributesList } from './attributes/readMode/AttributesList';
19
19
  export { default as ImageAttributesLine } from './attributes/readMode/ImageAttributesLine';
20
+ export { default as EditableImageAttributesLine } from './attributes/editMode/ImageAttributesLine';
20
21
  export { default as NestedAttribute } from './attributes/readMode/NestedAttribute';
21
22
  export { default as ReferenceAttribute } from './attributes/readMode/ReferenceAttribute';
22
23
  export { default as SimpleAttribute } from './attributes/readMode/SimpleAttribute';
@@ -16,6 +16,7 @@ export { default as EditableAttribute } from './attributes/editMode/AttributesFa
16
16
  export { default as ReadOnlyAttributeValuesBlock } from './attributes/readMode/AttributeValuesBlock/AttributeValuesBlock';
17
17
  export { default as ReadOnlyAttributesList } from './attributes/readMode/AttributesList';
18
18
  export { default as ImageAttributesLine } from './attributes/readMode/ImageAttributesLine';
19
+ export { default as EditableImageAttributesLine } from './attributes/editMode/ImageAttributesLine';
19
20
  export { default as NestedAttribute } from './attributes/readMode/NestedAttribute';
20
21
  export { default as ReferenceAttribute } from './attributes/readMode/ReferenceAttribute';
21
22
  export { default as SimpleAttribute } from './attributes/readMode/SimpleAttribute';
@@ -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 {};