@reltio/components 1.4.2202 → 1.4.2204

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 (121) hide show
  1. package/RolesInput/RolesInput.d.ts +2 -1
  2. package/RolesInput/RolesInput.js +2 -2
  3. package/TagsInput/TagsInput.d.ts +2 -1
  4. package/TagsInput/TagsInput.js +2 -2
  5. package/cjs/RolesInput/RolesInput.d.ts +2 -1
  6. package/cjs/RolesInput/RolesInput.js +2 -2
  7. package/cjs/TagsInput/TagsInput.d.ts +2 -1
  8. package/cjs/TagsInput/TagsInput.js +2 -2
  9. package/cjs/features/activity-log/RecordUpdates/RecordUpdates.d.ts +1 -0
  10. package/cjs/features/activity-log/RecordUpdates/RecordUpdates.js +2 -3
  11. package/cjs/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.d.ts +1 -1
  12. package/cjs/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.js +13 -9
  13. package/cjs/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.module.css.js +9 -0
  14. package/cjs/features/activity-log/types.d.ts +5 -0
  15. package/cjs/features/activity-log/types.js +7 -1
  16. package/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +2 -1
  17. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.d.ts +4 -1
  18. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +28 -18
  19. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.module.css.js +2 -2
  20. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemOldValue.js +1 -1
  21. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → ChangeItemLabel}/ChangeItemLabel.js +2 -2
  22. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.module.css.js +9 -0
  23. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/index.d.ts +1 -0
  24. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/index.js +5 -0
  25. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +3 -3
  26. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +20 -8
  27. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
  28. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → DCRValueEditor}/DCRValueEditor.d.ts +2 -1
  29. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → DCRValueEditor}/DCRValueEditor.js +6 -5
  30. package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditor/DCRValueEditor.module.css.js +9 -0
  31. package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditor/index.d.ts +1 -0
  32. package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditor/index.js +5 -0
  33. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → DCRValueEditorFactory}/DCRValueEditorFactory.d.ts +2 -1
  34. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → DCRValueEditorFactory}/DCRValueEditorFactory.js +4 -4
  35. package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/index.d.ts +1 -0
  36. package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/index.js +5 -0
  37. package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +4 -1
  38. package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.module.css.js +2 -2
  39. package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.d.ts +7 -0
  40. package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.js +21 -0
  41. package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.module.css.js +9 -0
  42. package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/index.d.ts +1 -0
  43. package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/index.js +5 -0
  44. package/cjs/features/workflow/ChangeRequestEditor/context/index.d.ts +4 -1
  45. package/cjs/features/workflow/ChangeRequestEditor/context/index.js +30 -4
  46. package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +2 -1
  47. package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.js +5 -1
  48. package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +16 -0
  49. package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +42 -0
  50. package/cjs/features/workflow/OperationChip/OperationChip.js +1 -1
  51. package/cjs/features/workflow/OperationChip/OperationChip.module.css.js +2 -2
  52. package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +1 -1
  53. package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.module.css.js +1 -1
  54. package/cjs/features/workflow/ReviewDCRDialog/components/DCRChangesSummary/DCRChangesSummary.module.css.js +1 -1
  55. package/cjs/features/workflow/ReviewDCRDialog/components/DCRSummaryInfo/DCRSummaryInfo.module.css.js +1 -1
  56. package/cjs/features/workflow/helpers/attributes.js +6 -4
  57. package/cjs/features/workflow/helpers/common.d.ts +1 -1
  58. package/cjs/features/workflow/helpers/common.js +3 -3
  59. package/cjs/features/workflow/helpers/common.test.js +4 -4
  60. package/cjs/features/workflow/helpers/merge.js +3 -1
  61. package/cjs/features/workflow/helpers/merge.test.js +79 -0
  62. package/features/activity-log/RecordUpdates/RecordUpdates.d.ts +1 -0
  63. package/features/activity-log/RecordUpdates/RecordUpdates.js +2 -3
  64. package/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.d.ts +1 -1
  65. package/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.js +14 -10
  66. package/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.module.css.js +9 -0
  67. package/features/activity-log/types.d.ts +5 -0
  68. package/features/activity-log/types.js +6 -0
  69. package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +2 -1
  70. package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.d.ts +4 -1
  71. package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +28 -18
  72. package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.module.css.js +2 -2
  73. package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemOldValue.js +1 -1
  74. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → ChangeItemLabel}/ChangeItemLabel.js +1 -1
  75. package/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.module.css.js +9 -0
  76. package/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/index.d.ts +1 -0
  77. package/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/index.js +1 -0
  78. package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +3 -3
  79. package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +20 -8
  80. package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
  81. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → DCRValueEditor}/DCRValueEditor.d.ts +2 -1
  82. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → DCRValueEditor}/DCRValueEditor.js +5 -4
  83. package/features/workflow/ChangeRequestEditor/components/DCRValueEditor/DCRValueEditor.module.css.js +9 -0
  84. package/features/workflow/ChangeRequestEditor/components/DCRValueEditor/index.d.ts +1 -0
  85. package/features/workflow/ChangeRequestEditor/components/DCRValueEditor/index.js +1 -0
  86. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → DCRValueEditorFactory}/DCRValueEditorFactory.d.ts +2 -1
  87. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → DCRValueEditorFactory}/DCRValueEditorFactory.js +4 -4
  88. package/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/index.d.ts +1 -0
  89. package/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/index.js +1 -0
  90. package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +4 -1
  91. package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.module.css.js +2 -2
  92. package/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.d.ts +7 -0
  93. package/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.js +14 -0
  94. package/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.module.css.js +9 -0
  95. package/features/workflow/ChangeRequestEditor/components/StatusChips/index.d.ts +1 -0
  96. package/features/workflow/ChangeRequestEditor/components/StatusChips/index.js +1 -0
  97. package/features/workflow/ChangeRequestEditor/context/index.d.ts +4 -1
  98. package/features/workflow/ChangeRequestEditor/context/index.js +30 -4
  99. package/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +2 -1
  100. package/features/workflow/ChangeRequestEditor/helpers/helpers.js +4 -1
  101. package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +16 -0
  102. package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +38 -0
  103. package/features/workflow/OperationChip/OperationChip.js +1 -1
  104. package/features/workflow/OperationChip/OperationChip.module.css.js +2 -2
  105. package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +2 -2
  106. package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.module.css.js +1 -1
  107. package/features/workflow/ReviewDCRDialog/components/DCRChangesSummary/DCRChangesSummary.module.css.js +1 -1
  108. package/features/workflow/ReviewDCRDialog/components/DCRSummaryInfo/DCRSummaryInfo.module.css.js +1 -1
  109. package/features/workflow/helpers/attributes.js +6 -4
  110. package/features/workflow/helpers/common.d.ts +1 -1
  111. package/features/workflow/helpers/common.js +3 -3
  112. package/features/workflow/helpers/common.test.js +4 -4
  113. package/features/workflow/helpers/merge.js +4 -2
  114. package/features/workflow/helpers/merge.test.js +79 -0
  115. package/package.json +2 -2
  116. package/cjs/features/activity-log/RecordUpdates/components/DeltaField/styles.d.ts +0 -1
  117. package/cjs/features/activity-log/RecordUpdates/components/DeltaField/styles.js +0 -36
  118. package/features/activity-log/RecordUpdates/components/DeltaField/styles.d.ts +0 -1
  119. package/features/activity-log/RecordUpdates/components/DeltaField/styles.js +0 -33
  120. /package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → ChangeItemLabel}/ChangeItemLabel.d.ts +0 -0
  121. /package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → ChangeItemLabel}/ChangeItemLabel.d.ts +0 -0
@@ -42,3 +42,9 @@ export var DeltaTypes;
42
42
  DeltaTypes["ATTRIBUTE_ADDED"] = "added";
43
43
  DeltaTypes["ATTRIBUTE_REMOVED"] = "deleted";
44
44
  })(DeltaTypes || (DeltaTypes = {}));
45
+ export var MemberDeltaTypes;
46
+ (function (MemberDeltaTypes) {
47
+ MemberDeltaTypes["MEMBER_CHANGED"] = "edited";
48
+ MemberDeltaTypes["MEMBER_ADDED"] = "added";
49
+ MemberDeltaTypes["MEMBER_REMOVED"] = "deleted";
50
+ })(MemberDeltaTypes || (MemberDeltaTypes = {}));
@@ -5,6 +5,7 @@ import Typography from '@mui/material/Typography';
5
5
  import { addLineIdToValue } from './helpers/helpers';
6
6
  import SvgSuggestedChanges from '../../../icons/SuggestedChanges';
7
7
  import { EntityChangesGroup, SkeletonEntityChangesGroupLoader } from './components/EntityChangesGroup';
8
+ import { ChangeRequestEditorProvider } from './context';
8
9
  import styles from './ChangeRequestEditor.module.css';
9
10
  export var ChangeRequestEditor = function (_a) {
10
11
  var dcr = _a.dcr, task = _a.task, groupedObjects = _a.groupedObjects;
@@ -22,5 +23,5 @@ export var ChangeRequestEditor = function (_a) {
22
23
  React.createElement("div", { className: styles.suggestedChangesIcon },
23
24
  React.createElement(SvgSuggestedChanges, null)),
24
25
  React.createElement(Typography, { variant: "h6", className: styles.suggestedChangesTitle }, i18n.text('Suggested changes'))),
25
- dcrLoaded ? (groupedObjects.map(function (object, index) { return (React.createElement(EntityChangesGroup, { key: "entity-".concat(index), entityInfo: object.entity, relationsInfo: object.relations, task: task, dcr: enrichedDCR })); })) : (React.createElement(SkeletonEntityChangesGroupLoader, null))));
26
+ dcrLoaded ? (React.createElement(ChangeRequestEditorProvider, null, groupedObjects.map(function (object, index) { return (React.createElement(EntityChangesGroup, { key: "entity-".concat(index), entityInfo: object.entity, relationsInfo: object.relations, task: task, dcr: enrichedDCR })); }))) : (React.createElement(SkeletonEntityChangesGroupLoader, null))));
26
27
  };
@@ -3,6 +3,9 @@ import { Diff } from '../../../types';
3
3
  type Props = {
4
4
  change: Diff;
5
5
  editable?: boolean;
6
+ classes?: {
7
+ rejectButton?: string;
8
+ };
6
9
  };
7
- export declare const ChangeItemEditor: ({ change, editable }: Props) => React.JSX.Element;
10
+ export declare const ChangeItemEditor: ({ change, editable, classes }: Props) => React.JSX.Element;
8
11
  export {};
@@ -1,32 +1,32 @@
1
+ import React, { useMemo } from 'react';
1
2
  import { isNil } from 'ramda';
2
- import React, { useCallback, useMemo } from 'react';
3
- import { useContextSelector } from '@fluentui/react-context-selector';
3
+ import classnames from 'classnames';
4
+ import ReplayIcon from '@mui/icons-material/Replay';
5
+ import Button from '@mui/material/Button';
6
+ import i18n from 'ui-i18n';
4
7
  import { DCROperationTypes, EntityAttrTypes, getAttributeValue } from '@reltio/mdm-sdk';
5
8
  import { useMdmMetadata } from '../../../../../contexts/MdmModuleContext';
6
9
  import { DataTypeValue } from '../../../../../DataTypeValue';
7
10
  import { getDataTypeDefinition, prepareRolesOrTagsValue } from '../../../helpers/common';
8
11
  import { OperationChip } from '../../../OperationChip';
9
12
  import { RelationEntityLink } from '../../../RelationEntityLink';
10
- import { ChangeRequestEditorContext } from '../../context';
11
- import { ChangeItemLabel } from './ChangeItemLabel';
12
- import { DCRValueEditor } from './DCRValueEditor';
13
- import { extractLineIds } from '../../../helpers/merge';
13
+ import { ChangeItemLabel } from '../ChangeItemLabel';
14
+ import { DCRValueEditor } from '../DCRValueEditor';
15
+ import { StatusChips } from '../StatusChips';
16
+ import { SmallIconButton } from '../../../../../SmallIconButton';
17
+ import { useChangeRequestEditor } from '../../hooks/useChangeRequestEditor';
14
18
  import styles from './ChangeItemEditor.module.css';
15
19
  export var ChangeItemEditor = function (_a) {
16
20
  var _b, _c, _d;
17
- var change = _a.change, _e = _a.editable, editable = _e === void 0 ? true : _e;
21
+ var change = _a.change, _e = _a.editable, editable = _e === void 0 ? true : _e, classes = _a.classes;
18
22
  var metadata = useMdmMetadata();
19
- var lineIds = change.lineIds || extractLineIds(change === null || change === void 0 ? void 0 : change.newValue);
20
- var lineData = useContextSelector(ChangeRequestEditorContext, function (context) { return lineIds && context.getLineData(lineIds[0]); });
21
- var updateChange = useContextSelector(ChangeRequestEditorContext, function (context) { return context.updateChange; });
22
- var onValueChange = useCallback(function (newValue) {
23
- updateChange(lineIds, typeof newValue === 'object' && 'value' in newValue ? newValue : { value: newValue });
24
- }, [lineIds, updateChange]);
23
+ var _f = useChangeRequestEditor({ change: change }), handleChange = _f.handleChange, handleReject = _f.handleReject, handleRevert = _f.handleRevert, lineData = _f.lineData, isLineRejected = _f.isLineRejected, isParentLineRejected = _f.isParentLineRejected, isUpdated = _f.isUpdated, hasChangeId = _f.hasChangeId;
25
24
  var isUpdateOperation = change.operation === DCROperationTypes.EDITED;
26
25
  var isAddOperation = change.operation === DCROperationTypes.ADDED;
27
26
  var hasAnyValue = Boolean(change.oldValue || change.newValue);
28
27
  var oldValue = getAttributeValue(change.oldValue);
29
- var newValue = getAttributeValue(isNil(lineData === null || lineData === void 0 ? void 0 : lineData.value) ? change.newValue : lineData.value);
28
+ var currentNewValue = !isNil(lineData === null || lineData === void 0 ? void 0 : lineData.value) && !isParentLineRejected ? lineData.value : change.newValue;
29
+ var newValue = getAttributeValue(currentNewValue);
30
30
  var hasNewValue = !isNil(newValue);
31
31
  var dataTypeDefinition = useMemo(function () {
32
32
  return change.attributeType && getDataTypeDefinition(change.attributeType, newValue || oldValue);
@@ -40,12 +40,22 @@ export var ChangeItemEditor = function (_a) {
40
40
  ? prepareRolesOrTagsValue(metadata, newValue, change.attributeType.uri)
41
41
  : newValue;
42
42
  }, [isRolesOrTags, metadata, newValue, (_d = change.attributeType) === null || _d === void 0 ? void 0 : _d.uri]);
43
- return (React.createElement("div", { className: styles.attributeRow },
43
+ var showUndoButton = (isUpdated || isLineRejected) && !isParentLineRejected;
44
+ var showRejectButton = !isLineRejected &&
45
+ !isUpdated &&
46
+ !isParentLineRejected &&
47
+ hasChangeId &&
48
+ !(change.isReferenceSubAttribute && !editable);
49
+ var showStatusChips = !isParentLineRejected;
50
+ var isRejected = isLineRejected || isParentLineRejected;
51
+ return (React.createElement("div", { className: styles.attributeRow, "data-reltio-id": "change-item-editor" },
44
52
  React.createElement(ChangeItemLabel, { change: change, className: styles.labelColumn, showLabel: !isUpdateOperation }),
45
53
  React.createElement("div", { className: styles.valueColumn },
46
54
  React.createElement(RelationEntityLink, { attributeOrRelationType: change.attributeType || change.relationType, attributeValue: change.attributeValue, className: styles.relationEntityLink }),
47
- shouldShowValueEditor ? (React.createElement(DCRValueEditor, { attributeType: change.attributeType, value: isNil(lineData === null || lineData === void 0 ? void 0 : lineData.value) ? change.newValue : lineData.value, onChange: onValueChange })) : (hasNewValue && (React.createElement("div", { className: styles.value },
55
+ shouldShowValueEditor ? (React.createElement(DCRValueEditor, { attributeType: change.attributeType, value: currentNewValue, onChange: handleChange, disabled: !editable || isRejected })) : (hasNewValue && (React.createElement("div", { className: styles.value },
48
56
  React.createElement(DataTypeValue, { value: preparedValue, dataTypeDefinition: dataTypeDefinition }))))),
49
- React.createElement("div", { className: styles.revertColumn }),
50
- React.createElement("div", { className: styles.operationColumn }, shouldShowOperationChip && (React.createElement(OperationChip, { operation: change.operation, size: "small", variant: "outlined" })))));
57
+ React.createElement("div", { className: styles.revertColumn }, showUndoButton && (React.createElement(SmallIconButton, { icon: ReplayIcon, onClick: handleRevert, className: styles.revertButton, title: i18n.text('Undo'), size: "S" }))),
58
+ React.createElement("div", { className: styles.operationColumn }, shouldShowOperationChip && (React.createElement(OperationChip, { operation: change.operation, size: "small", variant: "outlined" }))),
59
+ React.createElement("div", { className: styles.statusColumn }, showStatusChips && React.createElement(StatusChips, { showUpdatedChip: isUpdated, showRejectedChip: isLineRejected })),
60
+ React.createElement("div", { className: styles.rejectColumn }, showRejectButton && (React.createElement(Button, { onClick: handleReject, className: classnames(styles.rejectButton, classes === null || classes === void 0 ? void 0 : classes.rejectButton), title: i18n.text('Reject'), size: "medium" }, i18n.text('Reject'))))));
51
61
  };
@@ -1,9 +1,9 @@
1
- const styles = {"attributeRow":"ChangeItemEditor-attributeRow--bITG5","labelColumn":"ChangeItemEditor-labelColumn--6B4w4","changeLabel":"ChangeItemEditor-changeLabel--C7s6T","valueColumn":"ChangeItemEditor-valueColumn--q9456","revertColumn":"ChangeItemEditor-revertColumn--T5mVE","operationColumn":"ChangeItemEditor-operationColumn--me-4D","previousValue":"ChangeItemEditor-previousValue--lTOVp","previousValueText":"ChangeItemEditor-previousValueText--gAnge","editor":"ChangeItemEditor-editor--hyLPa","arrow":"ChangeItemEditor-arrow--IXZ6i","value":"ChangeItemEditor-value--GxSUf","columnSkeleton":"ChangeItemEditor-columnSkeleton---iGmr","relationEntityLink":"ChangeItemEditor-relationEntityLink--Vr7Z-"};
1
+ const styles = {"attributeRow":"ChangeItemEditor-attributeRow--bITG5","labelColumn":"ChangeItemEditor-labelColumn--6B4w4","valueColumn":"ChangeItemEditor-valueColumn--q9456","revertColumn":"ChangeItemEditor-revertColumn--T5mVE","operationColumn":"ChangeItemEditor-operationColumn--me-4D","statusColumn":"ChangeItemEditor-statusColumn--GEF2N","rejectColumn":"ChangeItemEditor-rejectColumn--ap8hp","previousValue":"ChangeItemEditor-previousValue--lTOVp","previousValueText":"ChangeItemEditor-previousValueText--gAnge","arrow":"ChangeItemEditor-arrow--IXZ6i","value":"ChangeItemEditor-value--GxSUf","columnSkeleton":"ChangeItemEditor-columnSkeleton---iGmr","relationEntityLink":"ChangeItemEditor-relationEntityLink--Vr7Z-","rejectButton":"ChangeItemEditor-rejectButton--cEIBC","revertButton":"ChangeItemEditor-revertButton--hSt3m"};
2
2
  if (typeof document !== 'undefined') {
3
3
  const head = document.head || document.getElementsByTagName('head')[0]
4
4
  const style = document.createElement('style');
5
5
  style.type = 'text/css'
6
- style.innerHTML = `.ChangeItemEditor-attributeRow--bITG5{align-items:center;display:flex;font-size:16px;gap:16px}.ChangeItemEditor-labelColumn--6B4w4{box-sizing:border-box;min-height:21px;width:170px}.ChangeItemEditor-changeLabel--C7s6T{color:var(--mui-palette-text-secondary);font-size:14px;font-weight:400;letter-spacing:.24px;padding-left:calc(var(--level, 0)*16px)}.ChangeItemEditor-valueColumn--q9456{display:flex;flex:1;flex-direction:column;gap:4px}.ChangeItemEditor-revertColumn--T5mVE{margin-left:-9px;width:24px}.ChangeItemEditor-operationColumn--me-4D{width:145px}.ChangeItemEditor-previousValue--lTOVp{align-items:center;display:flex;line-height:16px;padding:6px 12px 7px}.ChangeItemEditor-previousValueText--gAnge{color:var(--mui-palette-text-primary);letter-spacing:.24px}.ChangeItemEditor-editor--hyLPa{min-height:40px}.ChangeItemEditor-arrow--IXZ6i{color:var(--mui-palette-text-secondary);font-weight:700;margin:0 5px}.ChangeItemEditor-value--GxSUf{font-size:16px;padding:8px}.ChangeItemEditor-columnSkeleton---iGmr{transform:none}.ChangeItemEditor-relationEntityLink--Vr7Z-{font-size:16px}`;
6
+ style.innerHTML = `.ChangeItemEditor-attributeRow--bITG5{align-items:center;display:flex;font-size:16px;gap:16px;max-width:1000px;min-height:37px}.ChangeItemEditor-labelColumn--6B4w4{box-sizing:border-box;min-height:21px;width:170px}.ChangeItemEditor-valueColumn--q9456{display:flex;flex:1;flex-direction:column;gap:4px}.ChangeItemEditor-revertColumn--T5mVE{align-items:flex-start;display:flex;margin-left:-8px;width:16px}.ChangeItemEditor-operationColumn--me-4D{align-items:flex-start;display:flex;width:84px}.ChangeItemEditor-statusColumn--GEF2N{align-items:flex-start;display:flex;width:57px}.ChangeItemEditor-rejectColumn--ap8hp{align-items:flex-start;display:flex;width:80px}.ChangeItemEditor-previousValue--lTOVp{align-items:center;display:flex;line-height:16px;padding:6px 12px 7px}.ChangeItemEditor-previousValueText--gAnge{color:var(--mui-palette-text-primary);letter-spacing:.24px}.ChangeItemEditor-arrow--IXZ6i{color:var(--mui-palette-text-secondary);font-weight:700;margin:0 5px}.ChangeItemEditor-value--GxSUf{font-size:16px;padding:8px}.ChangeItemEditor-columnSkeleton---iGmr{transform:none}.ChangeItemEditor-relationEntityLink--Vr7Z-{font-size:16px}.ChangeItemEditor-rejectButton--cEIBC{background-color:#eb5757;border-radius:8px;color:#fff}.ChangeItemEditor-rejectButton--cEIBC:hover{background-color:rgba(235,87,87,.8)}.ChangeItemEditor-revertButton--hSt3m{color:var(--mui-palette-text-secondary)}`;
7
7
  head.appendChild(style);
8
8
  }
9
9
  export default styles;
@@ -4,7 +4,7 @@ import EastIcon from '@mui/icons-material/East';
4
4
  import { DCROperationTypes, getAttributeValue } from '@reltio/mdm-sdk';
5
5
  import { getDataTypeDefinition } from '../../../helpers/common';
6
6
  import { DataTypeValue } from '../../../../../DataTypeValue';
7
- import { ChangeItemLabel } from './ChangeItemLabel';
7
+ import { ChangeItemLabel } from '../ChangeItemLabel';
8
8
  import styles from './ChangeItemEditor.module.css';
9
9
  export var ChangeItemOldValue = function (_a) {
10
10
  var change = _a.change;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import classnames from 'classnames';
3
3
  import { useCssVariableStyles } from '../../../../../hooks/useCssVariableStyles';
4
- import styles from './ChangeItemEditor.module.css';
4
+ import styles from './ChangeItemLabel.module.css';
5
5
  export var ChangeItemLabel = function (_a) {
6
6
  var change = _a.change, className = _a.className, _b = _a.showLabel, showLabel = _b === void 0 ? true : _b;
7
7
  var _c = change.level, level = _c === void 0 ? 0 : _c, label = change.label;
@@ -0,0 +1,9 @@
1
+ const styles = {"changeLabel":"ChangeItemLabel-changeLabel--L-2ks"};
2
+ if (typeof document !== 'undefined') {
3
+ const head = document.head || document.getElementsByTagName('head')[0]
4
+ const style = document.createElement('style');
5
+ style.type = 'text/css'
6
+ style.innerHTML = `.ChangeItemLabel-changeLabel--L-2ks{color:var(--mui-palette-text-secondary);font-size:14px;font-weight:400;letter-spacing:.24px;padding-left:calc(var(--level, 0)*16px)}`;
7
+ head.appendChild(style);
8
+ }
9
+ export default styles;
@@ -0,0 +1 @@
1
+ export { ChangeItemLabel } from './ChangeItemLabel';
@@ -0,0 +1 @@
1
+ export { ChangeItemLabel } from './ChangeItemLabel';
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { GroupedObjectsInfo } from '@reltio/mdm-sdk';
3
- import { Diff, Title } from '../../../types';
3
+ import { Diff } from '../../../types';
4
4
  type Props = {
5
- item: Diff | Title;
5
+ change: Diff;
6
6
  entityInfo: GroupedObjectsInfo['entity'];
7
7
  };
8
- export declare const ChangeItemRow: ({ item, entityInfo }: Props) => React.JSX.Element;
8
+ export declare const ChangeItemRow: ({ change, entityInfo }: Props) => React.JSX.Element;
9
9
  export {};
@@ -1,20 +1,32 @@
1
1
  import classnames from 'classnames';
2
- import { has } from 'ramda';
3
2
  import React from 'react';
3
+ import { useContextSelector } from '@fluentui/react-context-selector';
4
4
  import { DCROperationTypes } from '@reltio/mdm-sdk';
5
5
  import { isEditableChange } from '../../helpers/helpers';
6
+ import { ChangeRequestEditorContext } from '../../context';
6
7
  import { ChangeItemEditor, ChangeItemOldValue } from '../ChangeItemEditor';
8
+ import { extractLineIds } from '../../../helpers/merge';
7
9
  import styles from './ChangeItemRow.module.css';
8
10
  export var ChangeItemRow = function (_a) {
9
11
  var _b;
10
- var item = _a.item, entityInfo = _a.entityInfo;
11
- if (!has('level', item)) {
12
- return React.createElement("div", { className: styles.title }, item.label);
13
- }
14
- var change = item;
12
+ var change = _a.change, entityInfo = _a.entityInfo;
13
+ var lineIds = change.lineIds || extractLineIds(change === null || change === void 0 ? void 0 : change.newValue);
14
+ var isParentLineRejected = useContextSelector(ChangeRequestEditorContext, function (context) {
15
+ return context.getIsParentLineRejected(lineIds === null || lineIds === void 0 ? void 0 : lineIds[0]);
16
+ });
17
+ var isLineRejected = useContextSelector(ChangeRequestEditorContext, function (context) {
18
+ return context.getIsLineRejected(lineIds === null || lineIds === void 0 ? void 0 : lineIds[0]);
19
+ });
20
+ var isUpdated = useContextSelector(ChangeRequestEditorContext, function (context) {
21
+ return context.getIsLineUpdated(lineIds === null || lineIds === void 0 ? void 0 : lineIds[0]);
22
+ });
15
23
  var isEditedOperation = change.operation === DCROperationTypes.EDITED;
16
24
  var editable = isEditableChange(change, entityInfo);
17
- return (React.createElement("div", { className: classnames(styles.changeItemRow, (_b = {}, _b[styles.editableRow] = editable, _b)) },
25
+ return (React.createElement("div", { className: classnames(styles.changeItemRow, (_b = {},
26
+ _b[styles.editableRow] = editable,
27
+ _b[styles.changedRow] = isUpdated,
28
+ _b[styles.rejectedRow] = isLineRejected || isParentLineRejected,
29
+ _b)) },
18
30
  isEditedOperation && React.createElement(ChangeItemOldValue, { change: change }),
19
- React.createElement(ChangeItemEditor, { change: change, editable: editable })));
31
+ React.createElement(ChangeItemEditor, { change: change, editable: editable, classes: { rejectButton: styles.rejectButton } })));
20
32
  };
@@ -1,9 +1,9 @@
1
- const styles = {"changeItemRow":"ChangeItemRow-changeItemRow--oF9hn","editableRow":"ChangeItemRow-editableRow--ZQzGk","title":"ChangeItemRow-title--G8iV2"};
1
+ const styles = {"changeItemRow":"ChangeItemRow-changeItemRow--oF9hn","rejectButton":"ChangeItemRow-rejectButton--iNbfM","changedRow":"ChangeItemRow-changedRow--32zBa","rejectedRow":"ChangeItemRow-rejectedRow--RqKQc"};
2
2
  if (typeof document !== 'undefined') {
3
3
  const head = document.head || document.getElementsByTagName('head')[0]
4
4
  const style = document.createElement('style');
5
5
  style.type = 'text/css'
6
- style.innerHTML = `.ChangeItemRow-changeItemRow--oF9hn{display:flex;flex-direction:column;gap:8px}.ChangeItemRow-editableRow--ZQzGk:hover{background:var(--mui-palette-action-hover)}.ChangeItemRow-title--G8iV2{color:var(--mui-palette-text-primary);font-size:14px;font-weight:600;margin:0 0 12px}`;
6
+ style.innerHTML = `.ChangeItemRow-changeItemRow--oF9hn{display:flex;flex-direction:column;gap:8px;transition:background-color .2s ease}.ChangeItemRow-rejectButton--iNbfM{opacity:0}.ChangeItemRow-changeItemRow--oF9hn:hover{background:var(--mui-palette-action-hover)}.ChangeItemRow-changeItemRow--oF9hn:hover .ChangeItemRow-rejectButton--iNbfM{opacity:1}.ChangeItemRow-changedRow--32zBa{background-color:#e5eff7}.ChangeItemRow-changedRow--32zBa:hover{background-color:rgba(229,239,247,.8)}.ChangeItemRow-rejectedRow--RqKQc{background-color:#f6e7e7}.ChangeItemRow-rejectedRow--RqKQc:hover{background-color:hsla(0,45%,94%,.8)}`;
7
7
  head.appendChild(style);
8
8
  }
9
9
  export default styles;
@@ -5,6 +5,7 @@ type Props = {
5
5
  attributeType: AttributeType;
6
6
  value: LineDataValue | ChangeValue;
7
7
  onChange: (value: SimpleAttributeValue | string[] | PrimitiveValue) => void;
8
+ disabled?: boolean;
8
9
  };
9
- export declare const DCRValueEditor: ({ attributeType, value, onChange }: Props) => React.JSX.Element;
10
+ export declare const DCRValueEditor: ({ attributeType, value, onChange, disabled }: Props) => React.JSX.Element;
10
11
  export {};
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
- import { DCRValueEditorFactory } from './DCRValueEditorFactory';
3
- import styles from './ChangeItemEditor.module.css';
2
+ import { DCRValueEditorFactory } from '../DCRValueEditorFactory';
3
+ import styles from './DCRValueEditor.module.css';
4
4
  export var DCRValueEditor = function (_a) {
5
- var attributeType = _a.attributeType, value = _a.value, onChange = _a.onChange;
5
+ var attributeType = _a.attributeType, value = _a.value, onChange = _a.onChange, _b = _a.disabled, disabled = _b === void 0 ? false : _b;
6
6
  return (React.createElement("div", { className: styles.editor }, DCRValueEditorFactory.build({
7
7
  attributeType: attributeType,
8
8
  value: value,
9
- onChange: onChange
9
+ onChange: onChange,
10
+ disabled: disabled
10
11
  })));
11
12
  };
@@ -0,0 +1,9 @@
1
+ const styles = {"editor":"DCRValueEditor-editor--H9Gz7"};
2
+ if (typeof document !== 'undefined') {
3
+ const head = document.head || document.getElementsByTagName('head')[0]
4
+ const style = document.createElement('style');
5
+ style.type = 'text/css'
6
+ style.innerHTML = `.DCRValueEditor-editor--H9Gz7{min-height:40px}`;
7
+ head.appendChild(style);
8
+ }
9
+ export default styles;
@@ -0,0 +1 @@
1
+ export { DCRValueEditor } from './DCRValueEditor';
@@ -0,0 +1 @@
1
+ export { DCRValueEditor } from './DCRValueEditor';
@@ -6,8 +6,9 @@ type Props = {
6
6
  value: LineDataValue | ChangeValue;
7
7
  onChange: (value: SimpleAttributeValue | string[] | PrimitiveValue) => void;
8
8
  dataTypeDefinition?: DataTypeDefinition;
9
+ disabled?: boolean;
9
10
  };
10
11
  export declare class DCRValueEditorFactory {
11
- static build({ attributeType, value, onChange }: Props): React.JSX.Element;
12
+ static build({ attributeType, value, onChange, disabled }: Props): React.JSX.Element;
12
13
  }
13
14
  export {};
@@ -10,17 +10,17 @@ var DCRValueEditorFactory = /** @class */ (function () {
10
10
  function DCRValueEditorFactory() {
11
11
  }
12
12
  DCRValueEditorFactory.build = function (_a) {
13
- var attributeType = _a.attributeType, value = _a.value, onChange = _a.onChange;
13
+ var attributeType = _a.attributeType, value = _a.value, onChange = _a.onChange, _b = _a.disabled, disabled = _b === void 0 ? false : _b;
14
14
  var dcrValue = getAttributeValue(value);
15
15
  switch (attributeType.uri) {
16
16
  case EntityAttrTypes.roles.uri: {
17
17
  var handleChange = function (values) {
18
18
  onChange((values === null || values === void 0 ? void 0 : values.map(prop('value'))) || []);
19
19
  };
20
- return React.createElement(RolesInput, { value: wrapInArrayIfNeeded(dcrValue), onChange: handleChange });
20
+ return (React.createElement(RolesInput, { value: wrapInArrayIfNeeded(dcrValue), onChange: handleChange, disabled: disabled }));
21
21
  }
22
22
  case EntityAttrTypes.tags.uri: {
23
- return React.createElement(TagsInput, { value: wrapInArrayIfNeeded(dcrValue), onChange: onChange });
23
+ return (React.createElement(TagsInput, { value: wrapInArrayIfNeeded(dcrValue), onChange: onChange, disabled: disabled }));
24
24
  }
25
25
  default: {
26
26
  var dataTypeDefinition = getDataTypeDefinition(attributeType, dcrValue);
@@ -31,7 +31,7 @@ var DCRValueEditorFactory = /** @class */ (function () {
31
31
  var valueConvertedToAttributeValue = editorValueToAttributeValue(attributeType, value);
32
32
  onChange(valueConvertedToAttributeValue);
33
33
  };
34
- return (React.createElement(DataTypeValueEditor, { fieldName: attributeType.uri, value: editorValue, dataTypeDefinition: dataTypeDefinition, onChange: handleChange, fullWidth: true }));
34
+ return (React.createElement(DataTypeValueEditor, { fieldName: attributeType.uri, value: editorValue, dataTypeDefinition: dataTypeDefinition, onChange: handleChange, fullWidth: true, disabled: disabled }));
35
35
  }
36
36
  }
37
37
  };
@@ -0,0 +1 @@
1
+ export { DCRValueEditorFactory } from './DCRValueEditorFactory';
@@ -0,0 +1 @@
1
+ export { DCRValueEditorFactory } from './DCRValueEditorFactory';
@@ -8,6 +8,7 @@ import { DCREntityUriLink } from '../../../DCREntityUriLink/DCREntityUriLink';
8
8
  import { ChangeItemRow } from '../ChangeItemRow/ChangeItemRow';
9
9
  import { AttributesChangesContext } from '../../../AttributesChanges/AttributesChangesContext';
10
10
  import { getDCRUri } from '../../../helpers/common';
11
+ import { isDiffChange } from '../../helpers/helpers';
11
12
  import styles from './EntityChangesGroup.module.css';
12
13
  export var EntityChangesGroup = function (_a) {
13
14
  var task = _a.task, dcr = _a.dcr, entityInfo = _a.entityInfo, relationsInfo = _a.relationsInfo;
@@ -24,5 +25,7 @@ export var EntityChangesGroup = function (_a) {
24
25
  content: styles.accordionContent
25
26
  } },
26
27
  React.createElement(DCREntityUriLink, { entityInfo: entityInfo, changes: changes, dcrUri: dcrUri, className: styles.entityTitle })),
27
- React.createElement(AccordionDetails, { className: styles.attributesList }, changesList.map(function (item, index) { return (React.createElement(ChangeItemRow, { key: "".concat('label' in item ? 'title' : 'change', "-").concat(index), item: item, entityInfo: entityInfo })); })))));
28
+ React.createElement(AccordionDetails, { className: styles.attributesList }, changesList.map(function (item, index) {
29
+ return isDiffChange(item) ? (React.createElement(ChangeItemRow, { key: "change-".concat(index), change: item, entityInfo: entityInfo })) : (React.createElement("div", { key: "title-".concat(index), className: styles.titleChangeItem }, item.label));
30
+ })))));
28
31
  };
@@ -1,9 +1,9 @@
1
- const styles = {"entityGroup":"EntityChangesGroup-entityGroup--KmWaa","entityHeader":"EntityChangesGroup-entityHeader--hf8-J","entityTitle":"EntityChangesGroup-entityTitle--caeZE","accordionContent":"EntityChangesGroup-accordionContent--N7C6Y","attributesList":"EntityChangesGroup-attributesList--7Tmk6","skeletonEntityGroupDisabled":"EntityChangesGroup-skeletonEntityGroupDisabled--qFGAK"};
1
+ const styles = {"entityGroup":"EntityChangesGroup-entityGroup--KmWaa","entityHeader":"EntityChangesGroup-entityHeader--hf8-J","entityTitle":"EntityChangesGroup-entityTitle--caeZE","accordionContent":"EntityChangesGroup-accordionContent--N7C6Y","attributesList":"EntityChangesGroup-attributesList--7Tmk6","titleChangeItem":"EntityChangesGroup-titleChangeItem--4s7tA","skeletonEntityGroupDisabled":"EntityChangesGroup-skeletonEntityGroupDisabled--qFGAK"};
2
2
  if (typeof document !== 'undefined') {
3
3
  const head = document.head || document.getElementsByTagName('head')[0]
4
4
  const style = document.createElement('style');
5
5
  style.type = 'text/css'
6
- style.innerHTML = `.EntityChangesGroup-entityGroup--KmWaa{background-color:#f7f7f7;border:1px solid #f0f0f0;border-radius:8px;box-shadow:none;margin:0 16px}.EntityChangesGroup-entityGroup--KmWaa.Mui-expanded{margin:0 16px}.EntityChangesGroup-entityGroup--KmWaa:before{display:none}.EntityChangesGroup-entityHeader--hf8-J{border-bottom:1px solid #f0f0f0;min-height:auto;padding:8px 16px}.EntityChangesGroup-entityHeader--hf8-J.Mui-expanded{min-height:auto}.EntityChangesGroup-entityTitle--caeZE{font-size:14px}.EntityChangesGroup-accordionContent--N7C6Y,.EntityChangesGroup-accordionContent--N7C6Y.Mui-expanded{margin:0}.EntityChangesGroup-attributesList--7Tmk6{display:flex;flex-direction:column;gap:8px;max-width:1000px;min-width:750px;padding:16px}.EntityChangesGroup-skeletonEntityGroupDisabled--qFGAK.Mui-disabled{background-color:#f7f7f7}`;
6
+ style.innerHTML = `.EntityChangesGroup-entityGroup--KmWaa{background-color:#f7f7f7;border:1px solid #f0f0f0;border-radius:8px;box-shadow:none;margin:0 16px}.EntityChangesGroup-entityGroup--KmWaa.Mui-expanded{margin:0 16px}.EntityChangesGroup-entityGroup--KmWaa:before{display:none}.EntityChangesGroup-entityHeader--hf8-J{border-bottom:1px solid #f0f0f0;min-height:auto;padding:8px 16px}.EntityChangesGroup-entityHeader--hf8-J.Mui-expanded{min-height:auto}.EntityChangesGroup-entityTitle--caeZE{font-size:14px}.EntityChangesGroup-accordionContent--N7C6Y,.EntityChangesGroup-accordionContent--N7C6Y.Mui-expanded{margin:0}.EntityChangesGroup-attributesList--7Tmk6{display:flex;flex-direction:column;gap:8px;min-width:750px;padding:16px}.EntityChangesGroup-titleChangeItem--4s7tA{color:var(--mui-palette-text-primary);font-size:14px;font-weight:600;margin:0 0 12px}.EntityChangesGroup-skeletonEntityGroupDisabled--qFGAK.Mui-disabled{background-color:#f7f7f7}`;
7
7
  head.appendChild(style);
8
8
  }
9
9
  export default styles;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ type Props = {
3
+ showUpdatedChip: boolean;
4
+ showRejectedChip: boolean;
5
+ };
6
+ export declare const StatusChips: ({ showUpdatedChip, showRejectedChip }: Props) => React.JSX.Element;
7
+ export {};
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import classnames from 'classnames';
3
+ import i18n from 'ui-i18n';
4
+ import Chip from '@mui/material/Chip';
5
+ import styles from './StatusChips.module.css';
6
+ export var StatusChips = function (_a) {
7
+ var showUpdatedChip = _a.showUpdatedChip, showRejectedChip = _a.showRejectedChip;
8
+ if (!showUpdatedChip && !showRejectedChip) {
9
+ return null;
10
+ }
11
+ var label = showUpdatedChip ? i18n.text('Updated') : i18n.text('Rejected');
12
+ var chipClass = showUpdatedChip ? styles.updatedChip : styles.rejectedChip;
13
+ return (React.createElement(Chip, { label: label, size: "small", color: "primary", variant: "outlined", className: classnames(styles.statusChip, chipClass), "data-testid": "status-chips" }));
14
+ };
@@ -0,0 +1,9 @@
1
+ const styles = {"statusChip":"StatusChips-statusChip--ws380","updatedChip":"StatusChips-updatedChip--5mTfA","rejectedChip":"StatusChips-rejectedChip--EHx3y"};
2
+ if (typeof document !== 'undefined') {
3
+ const head = document.head || document.getElementsByTagName('head')[0]
4
+ const style = document.createElement('style');
5
+ style.type = 'text/css'
6
+ style.innerHTML = `.StatusChips-statusChip--ws380{color:#fff;font-size:10px;height:20px}.StatusChips-updatedChip--5mTfA{background:#2f80ed;border:1px solid rgba(0,114,206,.3)}.StatusChips-rejectedChip--EHx3y{background:#eb5757;border:1px solid rgba(235,87,87,.3)}`;
7
+ head.appendChild(style);
8
+ }
9
+ export default styles;
@@ -0,0 +1 @@
1
+ export { StatusChips } from './StatusChips';
@@ -0,0 +1 @@
1
+ export { StatusChips } from './StatusChips';
@@ -1,5 +1,5 @@
1
- import { SimpleAttributeValue, PrimitiveValue } from '@reltio/mdm-sdk';
2
1
  import React from 'react';
2
+ import { SimpleAttributeValue, PrimitiveValue } from '@reltio/mdm-sdk';
3
3
  export type LineDataValue = SimpleAttributeValue | {
4
4
  value: string[] | PrimitiveValue;
5
5
  };
@@ -12,6 +12,9 @@ type ChangeRequestEditorContextType = {
12
12
  getLineData: (lineId: string) => LineData | undefined;
13
13
  rejectChange: (lineIds: string[]) => void;
14
14
  revertChangeUpdateOrReject: (lineIds: string[]) => void;
15
+ getIsParentLineRejected: (lineId: string) => boolean;
16
+ getIsLineRejected: (lineId: string) => boolean;
17
+ getIsLineUpdated: (lineId: string) => boolean;
15
18
  };
16
19
  export declare const ChangeRequestEditorContext: import("@fluentui/react-context-selector").Context<ChangeRequestEditorContextType>;
17
20
  export declare const ChangeRequestEditorProvider: ({ children }: {
@@ -1,10 +1,14 @@
1
- import { createContext } from '@fluentui/react-context-selector';
2
1
  import React, { useCallback, useState } from 'react';
2
+ import { isNil } from 'ramda';
3
+ import { createContext } from '@fluentui/react-context-selector';
3
4
  export var ChangeRequestEditorContext = createContext({
4
5
  updateChange: undefined,
5
6
  getLineData: undefined,
6
7
  rejectChange: undefined,
7
- revertChangeUpdateOrReject: undefined
8
+ revertChangeUpdateOrReject: undefined,
9
+ getIsParentLineRejected: undefined,
10
+ getIsLineRejected: undefined,
11
+ getIsLineUpdated: undefined
8
12
  });
9
13
  export var ChangeRequestEditorProvider = function (_a) {
10
14
  var children = _a.children;
@@ -31,7 +35,11 @@ export var ChangeRequestEditorProvider = function (_a) {
31
35
  setLineDataMap(function (prevMap) {
32
36
  var newMap = new Map(prevMap);
33
37
  lineIds.forEach(function (id) {
34
- newMap.delete(id);
38
+ newMap.forEach(function (_, key) {
39
+ if (key.startsWith("".concat(id, "/")) || key === id) {
40
+ newMap.delete(key);
41
+ }
42
+ });
35
43
  });
36
44
  return newMap;
37
45
  });
@@ -39,11 +47,29 @@ export var ChangeRequestEditorProvider = function (_a) {
39
47
  var getLineData = useCallback(function (lineId) {
40
48
  return lineDataMap.get(lineId);
41
49
  }, [lineDataMap]);
50
+ var getIsLineRejected = useCallback(function (lineId) {
51
+ var _a;
52
+ return ((_a = lineDataMap.get(lineId)) === null || _a === void 0 ? void 0 : _a.isRejected) || false;
53
+ }, [lineDataMap]);
54
+ var getIsParentLineRejected = useCallback(function (lineId) {
55
+ var lineIdParts = (lineId || '').split('/');
56
+ var possibleRejectedIds = Array.from({ length: lineIdParts.length - 1 }).reduce(function (ids, _, index) {
57
+ return ids.concat(lineIdParts.slice(0, index + 1).join('/'));
58
+ }, []);
59
+ return possibleRejectedIds.some(function (lineId) { var _a; return (_a = lineDataMap.get(lineId)) === null || _a === void 0 ? void 0 : _a.isRejected; });
60
+ }, [lineDataMap]);
61
+ var getIsLineUpdated = useCallback(function (lineId) {
62
+ var _a;
63
+ return !isNil((_a = lineDataMap.get(lineId)) === null || _a === void 0 ? void 0 : _a.value);
64
+ }, [lineDataMap]);
42
65
  var contextValue = {
43
66
  updateChange: updateChange,
44
67
  getLineData: getLineData,
45
68
  rejectChange: rejectChange,
46
- revertChangeUpdateOrReject: revertChangeUpdateOrReject
69
+ revertChangeUpdateOrReject: revertChangeUpdateOrReject,
70
+ getIsParentLineRejected: getIsParentLineRejected,
71
+ getIsLineRejected: getIsLineRejected,
72
+ getIsLineUpdated: getIsLineUpdated
47
73
  };
48
74
  return React.createElement(ChangeRequestEditorContext.Provider, { value: contextValue }, children);
49
75
  };
@@ -1,4 +1,5 @@
1
1
  import { DCRChanges, GroupedObjectsInfo, EnrichedDCRChanges } from '@reltio/mdm-sdk';
2
- import { Diff } from '../../types';
2
+ import { Diff, Title } from '../../types';
3
3
  export declare const isEditableChange: (change: Diff, entityInfo: GroupedObjectsInfo["entity"]) => boolean;
4
4
  export declare const addLineIdToValue: (data: DCRChanges) => EnrichedDCRChanges;
5
+ export declare const isDiffChange: (change: Diff | Title) => change is Diff;
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { clone, isNil } from 'ramda';
12
+ import { clone, has, isNil } from 'ramda';
13
13
  import { DCROperationTypes, DCRTypes, isRelationTypeUri } from '@reltio/mdm-sdk';
14
14
  export var isEditableChange = function (change, entityInfo) {
15
15
  var _a;
@@ -98,3 +98,6 @@ export var addLineIdToValue = function (data) {
98
98
  }
99
99
  return enrichedData;
100
100
  };
101
+ export var isDiffChange = function (change) {
102
+ return has('level', change);
103
+ };
@@ -0,0 +1,16 @@
1
+ import { PrimitiveValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
2
+ import { Diff } from '../../types';
3
+ type Props = {
4
+ change: Diff;
5
+ };
6
+ export declare const useChangeRequestEditor: ({ change }: Props) => {
7
+ handleChange: (newValue: SimpleAttributeValue | string[] | PrimitiveValue) => void;
8
+ handleReject: () => void;
9
+ handleRevert: () => void;
10
+ lineData: import("../context").LineData;
11
+ isLineRejected: boolean;
12
+ isParentLineRejected: boolean;
13
+ isUpdated: boolean;
14
+ hasChangeId: boolean;
15
+ };
16
+ export {};
@@ -0,0 +1,38 @@
1
+ import { useCallback } from 'react';
2
+ import { useContextSelector } from '@fluentui/react-context-selector';
3
+ import { ChangeRequestEditorContext } from '../context';
4
+ import { extractLineIds } from '../../helpers/merge';
5
+ var emptyLineIds = [];
6
+ export var useChangeRequestEditor = function (_a) {
7
+ var change = _a.change;
8
+ var lineIds = change.lineIds || extractLineIds(change === null || change === void 0 ? void 0 : change.newValue) || emptyLineIds;
9
+ var lineData = useContextSelector(ChangeRequestEditorContext, function (context) { return context.getLineData(lineIds[0]); });
10
+ var updateChange = useContextSelector(ChangeRequestEditorContext, function (context) { return context.updateChange; });
11
+ var rejectChange = useContextSelector(ChangeRequestEditorContext, function (context) { return context.rejectChange; });
12
+ var revertChangeUpdateOrReject = useContextSelector(ChangeRequestEditorContext, function (context) { return context.revertChangeUpdateOrReject; });
13
+ var isParentLineRejected = useContextSelector(ChangeRequestEditorContext, function (context) {
14
+ return context.getIsParentLineRejected(lineIds[0]);
15
+ });
16
+ var isUpdated = useContextSelector(ChangeRequestEditorContext, function (context) { return context.getIsLineUpdated(lineIds[0]); });
17
+ var isLineRejected = lineData === null || lineData === void 0 ? void 0 : lineData.isRejected;
18
+ var hasChangeId = lineIds.length > 0;
19
+ var handleChange = useCallback(function (newValue) {
20
+ updateChange(lineIds, typeof newValue === 'object' && 'value' in newValue ? newValue : { value: newValue });
21
+ }, [lineIds, updateChange]);
22
+ var handleReject = useCallback(function () {
23
+ rejectChange(lineIds);
24
+ }, [rejectChange, lineIds]);
25
+ var handleRevert = useCallback(function () {
26
+ revertChangeUpdateOrReject(lineIds);
27
+ }, [revertChangeUpdateOrReject, lineIds]);
28
+ return {
29
+ handleChange: handleChange,
30
+ handleReject: handleReject,
31
+ handleRevert: handleRevert,
32
+ lineData: lineData,
33
+ isLineRejected: isLineRejected,
34
+ isParentLineRejected: isParentLineRejected,
35
+ isUpdated: isUpdated,
36
+ hasChangeId: hasChangeId
37
+ };
38
+ };
@@ -5,5 +5,5 @@ import { getOperationLabel } from '../helpers/common';
5
5
  import styles from './OperationChip.module.css';
6
6
  export var OperationChip = function (_a) {
7
7
  var operation = _a.operation, className = _a.className, _b = _a.size, size = _b === void 0 ? 'small' : _b, _c = _a.variant, variant = _c === void 0 ? 'outlined' : _c;
8
- return (React.createElement(Chip, { variant: variant, label: getOperationLabel(operation), size: size, className: classnames(styles.chip, styles[operation], className) }));
8
+ return (React.createElement(Chip, { variant: variant, label: getOperationLabel(operation), size: size, className: classnames(styles.chip, styles[operation], className), classes: { label: styles.label } }));
9
9
  };
@@ -1,9 +1,9 @@
1
- const styles = {"chip":"OperationChip-chip--1GvDu","edited":"OperationChip-edited--szKT3","added":"OperationChip-added--LBI82","deleted":"OperationChip-deleted--3-a9r","ignored":"OperationChip-ignored--xwl3i"};
1
+ const styles = {"chip":"OperationChip-chip--1GvDu","label":"OperationChip-label--OCDk2","edited":"OperationChip-edited--szKT3","added":"OperationChip-added--LBI82","deleted":"OperationChip-deleted--3-a9r","ignored":"OperationChip-ignored--xwl3i"};
2
2
  if (typeof document !== 'undefined') {
3
3
  const head = document.head || document.getElementsByTagName('head')[0]
4
4
  const style = document.createElement('style');
5
5
  style.type = 'text/css'
6
- style.innerHTML = `.OperationChip-chip--1GvDu{border-color:var(--mui-palette-primary-main);color:var(--mui-palette-primary-main);flex-shrink:0;font-size:10px;font-weight:500;height:20px;letter-spacing:0;line-height:16px;text-transform:capitalize}.OperationChip-chip--1GvDu.OperationChip-edited--szKT3{border-color:#cc7500;color:#cc7500}.OperationChip-chip--1GvDu.OperationChip-added--LBI82{border-color:#599e0e;color:#599e0e}.OperationChip-chip--1GvDu.OperationChip-deleted--3-a9r{border-color:#cf0e26;color:#cf0e26}.OperationChip-chip--1GvDu.OperationChip-ignored--xwl3i{border-color:#3075c9;color:#3075c9}`;
6
+ style.innerHTML = `.OperationChip-chip--1GvDu{border-color:var(--mui-palette-primary-main);color:var(--mui-palette-primary-main);flex-shrink:0;font-size:10px;font-weight:500;height:20px;letter-spacing:0;line-height:16px}.OperationChip-label--OCDk2:first-letter{text-transform:uppercase}.OperationChip-chip--1GvDu.OperationChip-edited--szKT3{border-color:#cc7500;color:#cc7500}.OperationChip-chip--1GvDu.OperationChip-added--LBI82{border-color:#599e0e;color:#599e0e}.OperationChip-chip--1GvDu.OperationChip-deleted--3-a9r{border-color:#cf0e26;color:#cf0e26}.OperationChip-chip--1GvDu.OperationChip-ignored--xwl3i{border-color:#3075c9;color:#3075c9}`;
7
7
  head.appendChild(style);
8
8
  }
9
9
  export default styles;