@reltio/components 1.4.2200 → 1.4.2202

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/ProfileResizablePanes/ProfileResizablePanes.js +1 -1
  2. package/ProfileResizablePanes/ProfileResizablePanes.spec.js +16 -2
  3. package/RequestedData/RequestedData.d.ts +12 -0
  4. package/RequestedData/RequestedData.js +26 -0
  5. package/RequestedData/RequestedData.module.css.js +9 -0
  6. package/RequestedData/index.d.ts +1 -0
  7. package/RequestedData/index.js +1 -0
  8. package/cjs/ProfileResizablePanes/ProfileResizablePanes.js +1 -1
  9. package/cjs/ProfileResizablePanes/ProfileResizablePanes.spec.js +16 -2
  10. package/cjs/RequestedData/RequestedData.d.ts +12 -0
  11. package/cjs/RequestedData/RequestedData.js +33 -0
  12. package/cjs/RequestedData/RequestedData.module.css.js +9 -0
  13. package/cjs/RequestedData/index.d.ts +1 -0
  14. package/cjs/RequestedData/index.js +5 -0
  15. package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +5 -0
  16. package/cjs/features/activity-log/ActivitiesFactory/components/InteractionActivity/InteractionActivity.d.ts +8 -0
  17. package/cjs/features/activity-log/ActivitiesFactory/components/InteractionActivity/InteractionActivity.js +20 -0
  18. package/cjs/features/activity-log/ActivitiesFactory/components/InteractionActivity/index.d.ts +1 -0
  19. package/cjs/features/activity-log/ActivitiesFactory/components/InteractionActivity/index.js +5 -0
  20. package/cjs/features/activity-log/ActivityFilterEditor/helpers.test.js +3 -2
  21. package/cjs/features/activity-log/ActivityLog/helpers.js +1 -1
  22. package/cjs/features/activity-log/InteractionRecord/InteractionRecord.d.ts +7 -0
  23. package/cjs/features/activity-log/InteractionRecord/InteractionRecord.js +17 -0
  24. package/cjs/features/activity-log/InteractionRecord/index.d.ts +1 -0
  25. package/cjs/features/activity-log/InteractionRecord/index.js +5 -0
  26. package/cjs/features/activity-log/types.d.ts +3 -1
  27. package/cjs/features/activity-log/types.js +2 -0
  28. package/cjs/features/activity-log/utils/activities.js +2 -0
  29. package/cjs/features/history/types.d.ts +2 -0
  30. package/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +36 -3
  31. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.d.ts +1 -3
  32. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +15 -6
  33. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditor.d.ts +4 -3
  34. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditor.js +2 -28
  35. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditorFactory.d.ts +4 -3
  36. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditorFactory.js +11 -3
  37. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +2 -3
  38. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +5 -5
  39. package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.d.ts +2 -2
  40. package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +2 -28
  41. package/cjs/features/workflow/ChangeRequestEditor/context/index.d.ts +20 -0
  42. package/cjs/features/workflow/ChangeRequestEditor/context/index.js +76 -0
  43. package/cjs/features/workflow/ChangeRequestEditor/helpers/helper.test.d.ts +1 -0
  44. package/cjs/features/workflow/ChangeRequestEditor/helpers/helper.test.js +237 -0
  45. package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +4 -0
  46. package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.js +105 -0
  47. package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +3 -1
  48. package/cjs/features/workflow/helpers/attributes.js +14 -3
  49. package/cjs/features/workflow/helpers/attributes.test.js +29 -7
  50. package/cjs/features/workflow/helpers/merge.d.ts +3 -2
  51. package/cjs/features/workflow/helpers/merge.js +62 -18
  52. package/cjs/features/workflow/helpers/merge.test.js +56 -2
  53. package/cjs/features/workflow/hooks/useChangesList.d.ts +2 -2
  54. package/cjs/features/workflow/types.d.ts +4 -3
  55. package/cjs/index.d.ts +1 -0
  56. package/cjs/index.js +6 -4
  57. package/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +5 -0
  58. package/features/activity-log/ActivitiesFactory/components/InteractionActivity/InteractionActivity.d.ts +8 -0
  59. package/features/activity-log/ActivitiesFactory/components/InteractionActivity/InteractionActivity.js +13 -0
  60. package/features/activity-log/ActivitiesFactory/components/InteractionActivity/index.d.ts +1 -0
  61. package/features/activity-log/ActivitiesFactory/components/InteractionActivity/index.js +1 -0
  62. package/features/activity-log/ActivityFilterEditor/helpers.test.js +3 -2
  63. package/features/activity-log/ActivityLog/helpers.js +1 -1
  64. package/features/activity-log/InteractionRecord/InteractionRecord.d.ts +7 -0
  65. package/features/activity-log/InteractionRecord/InteractionRecord.js +10 -0
  66. package/features/activity-log/InteractionRecord/index.d.ts +1 -0
  67. package/features/activity-log/InteractionRecord/index.js +1 -0
  68. package/features/activity-log/types.d.ts +3 -1
  69. package/features/activity-log/types.js +2 -0
  70. package/features/activity-log/utils/activities.js +2 -0
  71. package/features/history/types.d.ts +2 -0
  72. package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +13 -3
  73. package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.d.ts +1 -3
  74. package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +15 -6
  75. package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditor.d.ts +4 -3
  76. package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditor.js +2 -5
  77. package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditorFactory.d.ts +4 -3
  78. package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/DCRValueEditorFactory.js +13 -5
  79. package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +2 -3
  80. package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +6 -6
  81. package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.d.ts +2 -2
  82. package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +2 -5
  83. package/features/workflow/ChangeRequestEditor/context/index.d.ts +20 -0
  84. package/features/workflow/ChangeRequestEditor/context/index.js +49 -0
  85. package/features/workflow/ChangeRequestEditor/helpers/helper.test.d.ts +1 -0
  86. package/features/workflow/ChangeRequestEditor/helpers/helper.test.js +235 -0
  87. package/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +4 -0
  88. package/features/workflow/ChangeRequestEditor/helpers/helpers.js +100 -0
  89. package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +3 -1
  90. package/features/workflow/helpers/attributes.js +14 -3
  91. package/features/workflow/helpers/attributes.test.js +29 -7
  92. package/features/workflow/helpers/merge.d.ts +3 -2
  93. package/features/workflow/helpers/merge.js +60 -17
  94. package/features/workflow/helpers/merge.test.js +56 -2
  95. package/features/workflow/hooks/useChangesList.d.ts +2 -2
  96. package/features/workflow/types.d.ts +4 -3
  97. package/index.d.ts +1 -0
  98. package/index.js +1 -0
  99. package/package.json +2 -2
  100. package/cjs/features/workflow/ChangeRequestEditor/helpers.d.ts +0 -3
  101. package/cjs/features/workflow/ChangeRequestEditor/helpers.js +0 -16
  102. package/features/workflow/ChangeRequestEditor/helpers.d.ts +0 -3
  103. package/features/workflow/ChangeRequestEditor/helpers.js +0 -12
@@ -4,13 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.DCRValueEditorFactory = void 0;
7
+ var ramda_1 = require("ramda");
7
8
  var react_1 = __importDefault(require("react"));
8
9
  var mdm_sdk_1 = require("@reltio/mdm-sdk");
9
10
  var DataTypeValueEditor_1 = require("../../../../../DataTypeValueEditor");
10
11
  var attributesView_1 = require("../../../../../helpers/attributesView");
11
- var common_1 = require("../../../helpers/common");
12
12
  var RolesInput_1 = require("../../../../../RolesInput/RolesInput");
13
13
  var TagsInput_1 = require("../../../../../TagsInput/TagsInput");
14
+ var common_1 = require("../../../helpers/common");
14
15
  var DCRValueEditorFactory = /** @class */ (function () {
15
16
  function DCRValueEditorFactory() {
16
17
  }
@@ -19,7 +20,10 @@ var DCRValueEditorFactory = /** @class */ (function () {
19
20
  var dcrValue = (0, mdm_sdk_1.getAttributeValue)(value);
20
21
  switch (attributeType.uri) {
21
22
  case mdm_sdk_1.EntityAttrTypes.roles.uri: {
22
- return react_1.default.createElement(RolesInput_1.RolesInput, { value: (0, mdm_sdk_1.wrapInArrayIfNeeded)(dcrValue), onChange: onChange });
23
+ var handleChange = function (values) {
24
+ onChange((values === null || values === void 0 ? void 0 : values.map((0, ramda_1.prop)('value'))) || []);
25
+ };
26
+ return react_1.default.createElement(RolesInput_1.RolesInput, { value: (0, mdm_sdk_1.wrapInArrayIfNeeded)(dcrValue), onChange: handleChange });
23
27
  }
24
28
  case mdm_sdk_1.EntityAttrTypes.tags.uri: {
25
29
  return react_1.default.createElement(TagsInput_1.TagsInput, { value: (0, mdm_sdk_1.wrapInArrayIfNeeded)(dcrValue), onChange: onChange });
@@ -29,7 +33,11 @@ var DCRValueEditorFactory = /** @class */ (function () {
29
33
  var editorValue = value && dataTypeDefinition
30
34
  ? (0, attributesView_1.attributeValueToEditorValue)(value, dataTypeDefinition)
31
35
  : null;
32
- return (react_1.default.createElement(DataTypeValueEditor_1.DataTypeValueEditor, { fieldName: attributeType.uri, value: editorValue, dataTypeDefinition: dataTypeDefinition, onChange: onChange, fullWidth: true }));
36
+ var handleChange = function (value) {
37
+ var valueConvertedToAttributeValue = (0, attributesView_1.editorValueToAttributeValue)(attributeType, value);
38
+ onChange(valueConvertedToAttributeValue);
39
+ };
40
+ return (react_1.default.createElement(DataTypeValueEditor_1.DataTypeValueEditor, { fieldName: attributeType.uri, value: editorValue, dataTypeDefinition: dataTypeDefinition, onChange: handleChange, fullWidth: true }));
33
41
  }
34
42
  }
35
43
  };
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
- import { GroupedObjectsInfo, DCRValue } from '@reltio/mdm-sdk';
2
+ import { GroupedObjectsInfo } from '@reltio/mdm-sdk';
3
3
  import { Diff, Title } from '../../../types';
4
4
  type Props = {
5
5
  item: Diff | Title;
6
- onValueChange: (id: string, newValue: DCRValue) => void;
7
6
  entityInfo: GroupedObjectsInfo['entity'];
8
7
  };
9
- export declare const ChangeItemRow: ({ item, onValueChange, entityInfo }: Props) => React.JSX.Element;
8
+ export declare const ChangeItemRow: ({ item, entityInfo }: Props) => React.JSX.Element;
10
9
  export {};
@@ -4,16 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ChangeItemRow = void 0;
7
- var react_1 = __importDefault(require("react"));
8
- var ramda_1 = require("ramda");
9
7
  var classnames_1 = __importDefault(require("classnames"));
8
+ var ramda_1 = require("ramda");
9
+ var react_1 = __importDefault(require("react"));
10
10
  var mdm_sdk_1 = require("@reltio/mdm-sdk");
11
- var helpers_1 = require("../../helpers");
11
+ var helpers_1 = require("../../helpers/helpers");
12
12
  var ChangeItemEditor_1 = require("../ChangeItemEditor");
13
13
  var ChangeItemRow_module_css_1 = __importDefault(require("./ChangeItemRow.module.css"));
14
14
  var ChangeItemRow = function (_a) {
15
15
  var _b;
16
- var item = _a.item, onValueChange = _a.onValueChange, entityInfo = _a.entityInfo;
16
+ var item = _a.item, entityInfo = _a.entityInfo;
17
17
  if (!(0, ramda_1.has)('level', item)) {
18
18
  return react_1.default.createElement("div", { className: ChangeItemRow_module_css_1.default.title }, item.label);
19
19
  }
@@ -22,6 +22,6 @@ var ChangeItemRow = function (_a) {
22
22
  var editable = (0, helpers_1.isEditableChange)(change, entityInfo);
23
23
  return (react_1.default.createElement("div", { className: (0, classnames_1.default)(ChangeItemRow_module_css_1.default.changeItemRow, (_b = {}, _b[ChangeItemRow_module_css_1.default.editableRow] = editable, _b)) },
24
24
  isEditedOperation && react_1.default.createElement(ChangeItemEditor_1.ChangeItemOldValue, { change: change }),
25
- react_1.default.createElement(ChangeItemEditor_1.ChangeItemEditor, { change: change, onValueChange: onValueChange, editable: editable })));
25
+ react_1.default.createElement(ChangeItemEditor_1.ChangeItemEditor, { change: change, editable: editable })));
26
26
  };
27
27
  exports.ChangeItemRow = ChangeItemRow;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { GroupedObjectsInfo, WorkflowTaskData, ChangeRequest } from '@reltio/mdm-sdk';
2
+ import { GroupedObjectsInfo, WorkflowTaskData, EnrichedChangeRequest } from '@reltio/mdm-sdk';
3
3
  type Props = {
4
4
  task: WorkflowTaskData;
5
- dcr: ChangeRequest;
5
+ dcr: EnrichedChangeRequest;
6
6
  entityInfo: GroupedObjectsInfo['entity'];
7
7
  relationsInfo: GroupedObjectsInfo['relations'];
8
8
  };
@@ -1,33 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
6
  exports.EntityChangesGroup = void 0;
30
- var react_1 = __importStar(require("react"));
7
+ var react_1 = __importDefault(require("react"));
31
8
  var Accordion_1 = __importDefault(require("@mui/material/Accordion"));
32
9
  var AccordionSummary_1 = __importDefault(require("@mui/material/AccordionSummary"));
33
10
  var AccordionDetails_1 = __importDefault(require("@mui/material/AccordionDetails"));
@@ -47,15 +24,12 @@ var EntityChangesGroup = function (_a) {
47
24
  entityInfo: entityInfo,
48
25
  relationsInfo: relationsInfo
49
26
  });
50
- var handleValueChange = (0, react_1.useCallback)(function () {
51
- // TODO: Implement value change logic
52
- }, []);
53
27
  return (react_1.default.createElement(AttributesChangesContext_1.AttributesChangesContext.Provider, { value: objectsInfo },
54
28
  react_1.default.createElement(Accordion_1.default, { className: EntityChangesGroup_module_css_1.default.entityGroup, defaultExpanded: true, "data-reltio-id": "entity-changes-group" },
55
29
  react_1.default.createElement(AccordionSummary_1.default, { expandIcon: react_1.default.createElement(ExpandMore_1.default, null), className: EntityChangesGroup_module_css_1.default.entityHeader, classes: {
56
30
  content: EntityChangesGroup_module_css_1.default.accordionContent
57
31
  } },
58
32
  react_1.default.createElement(DCREntityUriLink_1.DCREntityUriLink, { entityInfo: entityInfo, changes: changes, dcrUri: dcrUri, className: EntityChangesGroup_module_css_1.default.entityTitle })),
59
- react_1.default.createElement(AccordionDetails_1.default, { className: EntityChangesGroup_module_css_1.default.attributesList }, changesList.map(function (item, index) { return (react_1.default.createElement(ChangeItemRow_1.ChangeItemRow, { key: "".concat('label' in item ? 'title' : 'change', "-").concat(index), item: item, onValueChange: handleValueChange, entityInfo: entityInfo })); })))));
33
+ react_1.default.createElement(AccordionDetails_1.default, { className: EntityChangesGroup_module_css_1.default.attributesList }, changesList.map(function (item, index) { return (react_1.default.createElement(ChangeItemRow_1.ChangeItemRow, { key: "".concat('label' in item ? 'title' : 'change', "-").concat(index), item: item, entityInfo: entityInfo })); })))));
60
34
  };
61
35
  exports.EntityChangesGroup = EntityChangesGroup;
@@ -0,0 +1,20 @@
1
+ import { SimpleAttributeValue, PrimitiveValue } from '@reltio/mdm-sdk';
2
+ import React from 'react';
3
+ export type LineDataValue = SimpleAttributeValue | {
4
+ value: string[] | PrimitiveValue;
5
+ };
6
+ export type LineData = {
7
+ value?: LineDataValue;
8
+ isRejected?: boolean;
9
+ };
10
+ type ChangeRequestEditorContextType = {
11
+ updateChange: (lineIds: string[], data: LineDataValue) => void;
12
+ getLineData: (lineId: string) => LineData | undefined;
13
+ rejectChange: (lineIds: string[]) => void;
14
+ revertChangeUpdateOrReject: (lineIds: string[]) => void;
15
+ };
16
+ export declare const ChangeRequestEditorContext: import("@fluentui/react-context-selector").Context<ChangeRequestEditorContextType>;
17
+ export declare const ChangeRequestEditorProvider: ({ children }: {
18
+ children: React.ReactNode;
19
+ }) => React.JSX.Element;
20
+ export {};
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ChangeRequestEditorProvider = exports.ChangeRequestEditorContext = void 0;
27
+ var react_context_selector_1 = require("@fluentui/react-context-selector");
28
+ var react_1 = __importStar(require("react"));
29
+ exports.ChangeRequestEditorContext = (0, react_context_selector_1.createContext)({
30
+ updateChange: undefined,
31
+ getLineData: undefined,
32
+ rejectChange: undefined,
33
+ revertChangeUpdateOrReject: undefined
34
+ });
35
+ var ChangeRequestEditorProvider = function (_a) {
36
+ var children = _a.children;
37
+ var _b = (0, react_1.useState)(new Map()), lineDataMap = _b[0], setLineDataMap = _b[1];
38
+ var updateChange = (0, react_1.useCallback)(function (lineIds, data) {
39
+ setLineDataMap(function (prevMap) {
40
+ var newMap = new Map(prevMap);
41
+ lineIds.forEach(function (id) {
42
+ newMap.set(id, { value: data });
43
+ });
44
+ return newMap;
45
+ });
46
+ }, []);
47
+ var rejectChange = (0, react_1.useCallback)(function (lineIds) {
48
+ setLineDataMap(function (prevMap) {
49
+ var newMap = new Map(prevMap);
50
+ lineIds.forEach(function (id) {
51
+ newMap.set(id, { isRejected: true });
52
+ });
53
+ return newMap;
54
+ });
55
+ }, []);
56
+ var revertChangeUpdateOrReject = (0, react_1.useCallback)(function (lineIds) {
57
+ setLineDataMap(function (prevMap) {
58
+ var newMap = new Map(prevMap);
59
+ lineIds.forEach(function (id) {
60
+ newMap.delete(id);
61
+ });
62
+ return newMap;
63
+ });
64
+ }, []);
65
+ var getLineData = (0, react_1.useCallback)(function (lineId) {
66
+ return lineDataMap.get(lineId);
67
+ }, [lineDataMap]);
68
+ var contextValue = {
69
+ updateChange: updateChange,
70
+ getLineData: getLineData,
71
+ rejectChange: rejectChange,
72
+ revertChangeUpdateOrReject: revertChangeUpdateOrReject
73
+ };
74
+ return react_1.default.createElement(exports.ChangeRequestEditorContext.Provider, { value: contextValue }, children);
75
+ };
76
+ exports.ChangeRequestEditorProvider = ChangeRequestEditorProvider;
@@ -0,0 +1,237 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mdm_sdk_1 = require("@reltio/mdm-sdk");
4
+ var helpers_1 = require("./helpers");
5
+ describe('addLineIdToValue', function () {
6
+ it('should add lineIds for a simple attribute', function () {
7
+ var changes = {
8
+ 'entities/0FaSodQ': [
9
+ {
10
+ id: '4pomtm9',
11
+ type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
12
+ newValue: { value: '434' }
13
+ }
14
+ ]
15
+ };
16
+ var result = (0, helpers_1.addLineIdToValue)(changes);
17
+ expect(result).toEqual({
18
+ 'entities/0FaSodQ': [
19
+ {
20
+ id: '4pomtm9',
21
+ type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
22
+ newValue: {
23
+ value: '434',
24
+ lineIds: ['0FaSodQ/4pomtm9/newValue']
25
+ },
26
+ lineIds: ['0FaSodQ/4pomtm9']
27
+ }
28
+ ]
29
+ });
30
+ });
31
+ it('should add lineIds to the newValue of a UPDATE_TAGS change', function () {
32
+ var changes = {
33
+ 'entities/0FaSodQ': [
34
+ {
35
+ id: '0OSJEYr',
36
+ type: mdm_sdk_1.DCRTypes.UPDATE_TAGS,
37
+ newValue: ['www', 'qqq', 'sss'],
38
+ oldValue: ['aaa', 'bbb', 'ccc']
39
+ }
40
+ ]
41
+ };
42
+ var result = (0, helpers_1.addLineIdToValue)(changes);
43
+ expect(result).toEqual({
44
+ 'entities/0FaSodQ': [
45
+ {
46
+ id: '0OSJEYr',
47
+ type: mdm_sdk_1.DCRTypes.UPDATE_TAGS,
48
+ newValue: {
49
+ value: ['www', 'qqq', 'sss'],
50
+ lineIds: ['0FaSodQ/0OSJEYr/newValue']
51
+ },
52
+ oldValue: {
53
+ value: ['aaa', 'bbb', 'ccc'],
54
+ lineIds: ['0FaSodQ/0OSJEYr/oldValue']
55
+ },
56
+ lineIds: ['0FaSodQ/0OSJEYr']
57
+ }
58
+ ]
59
+ });
60
+ });
61
+ it('should recursively add lineIds to nested attribute values', function () {
62
+ var changes = {
63
+ 'entities/0FaSodQ': [
64
+ {
65
+ id: '4ponaOj',
66
+ type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
67
+ newValue: {
68
+ value: {
69
+ TextField: [{ value: 'Test' }],
70
+ Int: [{ value: '42' }]
71
+ }
72
+ }
73
+ }
74
+ ]
75
+ };
76
+ var result = (0, helpers_1.addLineIdToValue)(changes);
77
+ expect(result).toEqual({
78
+ 'entities/0FaSodQ': [
79
+ {
80
+ id: '4ponaOj',
81
+ type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE,
82
+ newValue: {
83
+ value: {
84
+ TextField: [
85
+ {
86
+ value: 'Test',
87
+ lineIds: ['0FaSodQ/4ponaOj/newValue/value/TextField/0']
88
+ }
89
+ ],
90
+ Int: [
91
+ {
92
+ value: '42',
93
+ lineIds: ['0FaSodQ/4ponaOj/newValue/value/Int/0']
94
+ }
95
+ ]
96
+ },
97
+ lineIds: ['0FaSodQ/4ponaOj/newValue']
98
+ },
99
+ lineIds: ['0FaSodQ/4ponaOj']
100
+ }
101
+ ]
102
+ });
103
+ });
104
+ it('should add lineIds to all attributes of CREATE_ENTITY changes', function () {
105
+ var changes = {
106
+ 'entities/1PMfzz2w': [
107
+ {
108
+ id: '36a3GSVm',
109
+ type: mdm_sdk_1.DCRTypes.CREATE_ENTITY,
110
+ objectType: 'configuration/entityTypes/Location',
111
+ newValue: {
112
+ attributes: {
113
+ AddressLine1: [{ value: 'www' }],
114
+ CityTierName: [{ value: 'ALBY' }]
115
+ },
116
+ type: 'configuration/entityTypes/Location',
117
+ uri: 'entities/0T5H79G'
118
+ }
119
+ }
120
+ ]
121
+ };
122
+ var result = (0, helpers_1.addLineIdToValue)(changes);
123
+ expect(result).toEqual({
124
+ 'entities/1PMfzz2w': [
125
+ {
126
+ id: '36a3GSVm',
127
+ type: mdm_sdk_1.DCRTypes.CREATE_ENTITY,
128
+ objectType: 'configuration/entityTypes/Location',
129
+ newValue: {
130
+ attributes: {
131
+ AddressLine1: [
132
+ {
133
+ value: 'www',
134
+ lineIds: ['1PMfzz2w/36a3GSVm/newValue/attributes/AddressLine1/0']
135
+ }
136
+ ],
137
+ CityTierName: [
138
+ {
139
+ value: 'ALBY',
140
+ lineIds: ['1PMfzz2w/36a3GSVm/newValue/attributes/CityTierName/0']
141
+ }
142
+ ]
143
+ },
144
+ type: 'configuration/entityTypes/Location',
145
+ uri: 'entities/0T5H79G',
146
+ lineIds: ['1PMfzz2w/36a3GSVm/newValue']
147
+ },
148
+ lineIds: ['1PMfzz2w/36a3GSVm']
149
+ }
150
+ ]
151
+ });
152
+ });
153
+ it('should add lineIds to all attributes of CREATE_RELATIONSHIP changes', function () {
154
+ var changes = {
155
+ 'relations/0lVSmtX': [
156
+ {
157
+ id: '0G7u0JP',
158
+ type: mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP,
159
+ newValue: {
160
+ attributes: {
161
+ PrefOrActive: [{ value: 'yfhgvm' }],
162
+ AffiliationStatus: [{ value: 'Status 1' }],
163
+ PrimaryAffiliationIndicator: [{ value: 'true' }]
164
+ },
165
+ type: 'configuration/relationTypes/DirPharmacy',
166
+ uri: 'relations/0Mj0zAI'
167
+ }
168
+ }
169
+ ]
170
+ };
171
+ var result = (0, helpers_1.addLineIdToValue)(changes);
172
+ expect(result).toEqual({
173
+ 'relations/0lVSmtX': [
174
+ {
175
+ id: '0G7u0JP',
176
+ type: mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP,
177
+ newValue: {
178
+ attributes: {
179
+ PrefOrActive: [
180
+ {
181
+ value: 'yfhgvm',
182
+ lineIds: ['0lVSmtX/0G7u0JP/newValue/attributes/PrefOrActive/0']
183
+ }
184
+ ],
185
+ AffiliationStatus: [
186
+ {
187
+ value: 'Status 1',
188
+ lineIds: ['0lVSmtX/0G7u0JP/newValue/attributes/AffiliationStatus/0']
189
+ }
190
+ ],
191
+ PrimaryAffiliationIndicator: [
192
+ {
193
+ value: 'true',
194
+ lineIds: ['0lVSmtX/0G7u0JP/newValue/attributes/PrimaryAffiliationIndicator/0']
195
+ }
196
+ ]
197
+ },
198
+ type: 'configuration/relationTypes/DirPharmacy',
199
+ uri: 'relations/0Mj0zAI',
200
+ lineIds: ['0lVSmtX/0G7u0JP/newValue']
201
+ },
202
+ lineIds: ['0lVSmtX/0G7u0JP']
203
+ }
204
+ ]
205
+ });
206
+ });
207
+ it('should add lineIds to both oldValue and newValue for UPDATE_ATTRIBUTE changes', function () {
208
+ var changes = {
209
+ 'entities/0FaSodQ': [
210
+ {
211
+ id: '4pomtm9',
212
+ type: mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE,
213
+ oldValue: { value: 'old' },
214
+ newValue: { value: 'new' }
215
+ }
216
+ ]
217
+ };
218
+ var result = (0, helpers_1.addLineIdToValue)(changes);
219
+ expect(result).toEqual({
220
+ 'entities/0FaSodQ': [
221
+ {
222
+ id: '4pomtm9',
223
+ type: mdm_sdk_1.DCRTypes.UPDATE_ATTRIBUTE,
224
+ oldValue: {
225
+ value: 'old',
226
+ lineIds: ['0FaSodQ/4pomtm9/oldValue']
227
+ },
228
+ newValue: {
229
+ value: 'new',
230
+ lineIds: ['0FaSodQ/4pomtm9/newValue']
231
+ },
232
+ lineIds: ['0FaSodQ/4pomtm9']
233
+ }
234
+ ]
235
+ });
236
+ });
237
+ });
@@ -0,0 +1,4 @@
1
+ import { DCRChanges, GroupedObjectsInfo, EnrichedDCRChanges } from '@reltio/mdm-sdk';
2
+ import { Diff } from '../../types';
3
+ export declare const isEditableChange: (change: Diff, entityInfo: GroupedObjectsInfo["entity"]) => boolean;
4
+ export declare const addLineIdToValue: (data: DCRChanges) => EnrichedDCRChanges;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.addLineIdToValue = exports.isEditableChange = void 0;
15
+ var ramda_1 = require("ramda");
16
+ var mdm_sdk_1 = require("@reltio/mdm-sdk");
17
+ var isEditableChange = function (change, entityInfo) {
18
+ var _a;
19
+ var currentAttributeTypeUri = (_a = change.attributeType) === null || _a === void 0 ? void 0 : _a.uri;
20
+ var isExistingReferenceEntityChange = entityInfo.isExist &&
21
+ currentAttributeTypeUri &&
22
+ change.isReferenceSubAttribute &&
23
+ change.operation === mdm_sdk_1.DCROperationTypes.ADDED &&
24
+ !(0, mdm_sdk_1.isRelationTypeUri)(currentAttributeTypeUri);
25
+ return !!currentAttributeTypeUri && !isExistingReferenceEntityChange && !(0, ramda_1.isNil)(change.newValue);
26
+ };
27
+ exports.isEditableChange = isEditableChange;
28
+ var isPrimitiveValue = function (value) {
29
+ return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean';
30
+ };
31
+ var addLineIdRecursively = function (value, basePath) {
32
+ if (value == null)
33
+ return value;
34
+ if (Array.isArray(value)) {
35
+ return value.map(function (entry, index) {
36
+ if (entry && typeof entry === 'object') {
37
+ var entryPath = "".concat(basePath, "/").concat(index);
38
+ var newEntry = (0, ramda_1.clone)(entry);
39
+ newEntry.lineIds = [entryPath];
40
+ var v = newEntry.value;
41
+ if (typeof v === 'object' && v !== null) {
42
+ newEntry.value = addLineIdRecursively(v, "".concat(entryPath, "/value"));
43
+ }
44
+ return newEntry;
45
+ }
46
+ return entry;
47
+ });
48
+ }
49
+ if (typeof value === 'object') {
50
+ var result = {};
51
+ for (var _i = 0, _a = Object.entries(value); _i < _a.length; _i++) {
52
+ var _b = _a[_i], key = _b[0], val = _b[1];
53
+ var childPath = "".concat(basePath, "/").concat(key);
54
+ result[key] = addLineIdRecursively(val, childPath);
55
+ }
56
+ return result;
57
+ }
58
+ return value;
59
+ };
60
+ var addLineIdToChangeValue = function (container, basePath, type) {
61
+ if (container == null)
62
+ return container;
63
+ if ([mdm_sdk_1.DCRTypes.CREATE_ENTITY, mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP].includes(type)) {
64
+ var attributes = void 0;
65
+ if ('attributes' in container && typeof container.attributes === 'object') {
66
+ attributes = addLineIdRecursively(container.attributes, "".concat(basePath, "/attributes"));
67
+ }
68
+ return __assign(__assign({}, container), { attributes: attributes, lineIds: [basePath] });
69
+ }
70
+ if (Array.isArray(container)) {
71
+ return { value: container, lineIds: [basePath] };
72
+ }
73
+ if (typeof container === 'object' && 'value' in container) {
74
+ var containerValue = container.value;
75
+ return __assign(__assign({}, container), { lineIds: [basePath], value: isPrimitiveValue(containerValue)
76
+ ? containerValue
77
+ : addLineIdRecursively(containerValue, "".concat(basePath, "/value")) });
78
+ }
79
+ return container;
80
+ };
81
+ var addLineIdToValue = function (data) {
82
+ var enrichedData = (0, ramda_1.clone)(data);
83
+ for (var entityOrRelationKey in enrichedData) {
84
+ var entityOrRelationId = entityOrRelationKey.split('/')[1];
85
+ var changeList = enrichedData[entityOrRelationKey];
86
+ if (!Array.isArray(changeList))
87
+ continue;
88
+ for (var _i = 0, changeList_1 = changeList; _i < changeList_1.length; _i++) {
89
+ var change = changeList_1[_i];
90
+ var changeId = change.id;
91
+ var type = change.type;
92
+ if (change.newValue != null) {
93
+ var root = "".concat(entityOrRelationId, "/").concat(changeId, "/newValue");
94
+ change.newValue = addLineIdToChangeValue(change.newValue, root, type);
95
+ }
96
+ if (change.oldValue != null) {
97
+ var root = "".concat(entityOrRelationId, "/").concat(changeId, "/oldValue");
98
+ change.oldValue = addLineIdToChangeValue(change.oldValue, root, type);
99
+ }
100
+ change.lineIds = ["".concat(entityOrRelationId, "/").concat(changeId)];
101
+ }
102
+ }
103
+ return enrichedData;
104
+ };
105
+ exports.addLineIdToValue = addLineIdToValue;
@@ -15,6 +15,7 @@ var ui_i18n_1 = __importDefault(require("ui-i18n"));
15
15
  var useWorkflowCheckPermission_1 = require("../hooks/useWorkflowCheckPermission");
16
16
  var useWorkflowActions_1 = require("../hooks/useWorkflowActions");
17
17
  var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
18
+ var context_1 = require("../ChangeRequestEditor/context");
18
19
  var ProfileBand_1 = require("../../../ProfileBand");
19
20
  var DueDateField_1 = require("../DueDateField");
20
21
  var PrioritySelector_1 = require("../PrioritySelector");
@@ -54,7 +55,8 @@ var ReviewDCRDialog = function (_a) {
54
55
  react_1.default.createElement("div", { className: ReviewDCRDialog_module_css_1.default.editableItem },
55
56
  react_1.default.createElement(AssigneeSelector_1.AssigneeSelector, { taskId: task.taskId, assignee: task.assignee, isTaskOpen: task.isOpen })))),
56
57
  react_1.default.createElement("div", { className: ReviewDCRDialog_module_css_1.default.changesSection },
57
- react_1.default.createElement(ChangeRequestEditor_1.ChangeRequestEditor, { dcr: dcr, task: task, groupedObjects: groupedObjects }))),
58
+ react_1.default.createElement(context_1.ChangeRequestEditorProvider, null,
59
+ react_1.default.createElement(ChangeRequestEditor_1.ChangeRequestEditor, { dcr: dcr, task: task, groupedObjects: groupedObjects })))),
58
60
  canViewComments && (react_1.default.createElement(WorkflowComments_1.WorkflowComments, { workflowActions: workflowActions, actionRequestIsInProgress: actionRequestIsInProgress, preferredAction: task.preferredAction, taskId: task.taskId, processInstanceComments: task.processInstanceComments, isTaskOpen: task.isOpen, showActionButtons: false, alwaysExpanded: true, classes: {
59
61
  container: ReviewDCRDialog_module_css_1.default.commentsRootContainer,
60
62
  commentsContainer: ReviewDCRDialog_module_css_1.default.commentsContainer
@@ -64,19 +64,30 @@ var dcrAttributesFactory = function (metadata, attributeType, attributeValue, le
64
64
  }
65
65
  }
66
66
  };
67
+ var extractLineIds = function (attributeValue) {
68
+ var _a, _b;
69
+ return typeof attributeValue.value === 'object' &&
70
+ 'newValue' in attributeValue.value &&
71
+ 'lineIds' in attributeValue.value.newValue &&
72
+ Array.isArray(attributeValue.value.newValue.lineIds)
73
+ ? (_b = (_a = attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.value) === null || _a === void 0 ? void 0 : _a.newValue) === null || _b === void 0 ? void 0 : _b.lineIds
74
+ : attributeValue.lineIds;
75
+ };
67
76
  var getNestedAttributeChange = function (metadata, attributeType, attributeValue, level) {
68
77
  var attributeTypeList = (0, mdm_sdk_1.getAttributeTypeSubAttributes)({}, attributeType);
69
78
  var label = (0, mdm_sdk_1.getLabel)((attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name));
79
+ var lineIds = extractLineIds(attributeValue);
70
80
  return [
71
- { level: level, label: label, attributeType: attributeType, attributeValue: attributeValue },
81
+ { level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds },
72
82
  getAttributesList(metadata, attributeTypeList, attributeValue.value, level + 1)
73
83
  ];
74
84
  };
75
85
  var getReferenceAttributeChange = function (metadata, attributeType, attributeValue, level) {
76
86
  var attributeTypeList = (0, mdm_sdk_1.getAttributeTypeSubAttributes)(metadata, attributeType);
77
87
  var label = (attributeType === null || attributeType === void 0 ? void 0 : attributeType.label) || (attributeType === null || attributeType === void 0 ? void 0 : attributeType.name);
88
+ var lineIds = extractLineIds(attributeValue);
78
89
  return [
79
- { level: level, label: label, attributeType: attributeType, attributeValue: attributeValue },
90
+ { level: level, label: label, attributeType: attributeType, attributeValue: attributeValue, lineIds: lineIds },
80
91
  getAttributesList(metadata, attributeTypeList, attributeValue.value, level + 1, true)
81
92
  ];
82
93
  };
@@ -114,7 +125,7 @@ exports.getRelationChanges = (0, ramda_1.curry)(function (metadata, relationInfo
114
125
  var relationType = (0, mdm_sdk_1.getRelationType)(metadata, relationInfo.type);
115
126
  var attrTypes = (0, mdm_sdk_1.getRelationAttributesList)(metadata, relationInfo.type);
116
127
  return (0, ramda_1.flatten)([
117
- __assign({ level: 1, label: (0, ramda_1.propOr)('', 'label', relationType), attributeType: null, relationType: relationType, attributeValue: __assign(__assign({}, relationInfo), changes) }, addRelationOperationIfNeeded(changes, changeType)),
128
+ __assign({ level: 1, label: (0, ramda_1.propOr)('', 'label', relationType), attributeType: null, relationType: relationType, attributeValue: __assign(__assign({}, relationInfo), changes), lineIds: changes === null || changes === void 0 ? void 0 : changes.lineIds }, addRelationOperationIfNeeded(changes, changeType)),
118
129
  getAttributesList(metadata, attrTypes, changes, 2)
119
130
  ]);
120
131
  });