@reltio/components 1.4.2243 → 1.4.2245

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 (217) hide show
  1. package/ActivenessDateControl/ActivenessDateControl.d.ts +9 -0
  2. package/ActivenessDateControl/ActivenessDateControl.js +11 -0
  3. package/ActivenessDateControl/index.d.ts +1 -0
  4. package/ActivenessDateControl/index.js +1 -0
  5. package/EntitySelector/EntitySelector.d.ts +2 -1
  6. package/EntitySelector/EntitySelector.js +2 -2
  7. package/EntitySelector/index.d.ts +1 -0
  8. package/MoreAttributesButton/MoreAttributesButton.d.ts +3 -2
  9. package/MoreAttributesButton/MoreAttributesButton.js +8 -8
  10. package/MoreAttributesButton/useMoreAttributesItems.d.ts +4 -4
  11. package/cjs/ActivenessDateControl/ActivenessDateControl.d.ts +9 -0
  12. package/cjs/ActivenessDateControl/ActivenessDateControl.js +18 -0
  13. package/cjs/ActivenessDateControl/index.d.ts +1 -0
  14. package/cjs/ActivenessDateControl/index.js +5 -0
  15. package/cjs/EntitySelector/EntitySelector.d.ts +2 -1
  16. package/cjs/EntitySelector/EntitySelector.js +2 -2
  17. package/cjs/EntitySelector/index.d.ts +1 -0
  18. package/cjs/MoreAttributesButton/MoreAttributesButton.d.ts +3 -2
  19. package/cjs/MoreAttributesButton/MoreAttributesButton.js +8 -8
  20. package/cjs/MoreAttributesButton/useMoreAttributesItems.d.ts +4 -4
  21. package/cjs/features/activity-log/ActivityLog/ActivityLog.test.js +28 -0
  22. package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.js +22 -11
  23. package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.module.css.js +9 -0
  24. package/cjs/features/activity-log/ActivityLog/constants.d.ts +17 -0
  25. package/cjs/features/activity-log/ActivityLog/constants.js +20 -0
  26. package/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.d.ts +1 -1
  27. package/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +20 -9
  28. package/cjs/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.d.ts +7 -0
  29. package/cjs/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.js +67 -0
  30. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.js +3 -1
  31. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.module.css.js +2 -2
  32. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +2 -2
  33. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +31 -9
  34. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
  35. package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.d.ts +9 -0
  36. package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.js +79 -0
  37. package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.d.ts +1 -0
  38. package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.js +5 -0
  39. package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +2 -2
  40. package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.js +2 -2
  41. package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.d.ts +11 -0
  42. package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.js +41 -0
  43. package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.module.css.js +9 -0
  44. package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.d.ts +1 -0
  45. package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.js +6 -0
  46. package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.d.ts +1 -1
  47. package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +134 -5
  48. package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/SkeletonEntityChangesGroupLoader.js +2 -2
  49. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/ChangeItemEditor.d.ts +1 -1
  50. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.js +110 -0
  51. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.module.css.js +9 -0
  52. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.js +6 -5
  53. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.d.ts +0 -1
  54. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.js +1 -3
  55. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.d.ts +8 -0
  56. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.js +89 -0
  57. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.d.ts +1 -0
  58. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.js +5 -0
  59. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.d.ts +1 -1
  60. package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.js +12 -11
  61. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/ChangeItemOldValue.module.css.js +9 -0
  62. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.d.ts +1 -0
  63. package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.js +5 -0
  64. package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.d.ts +11 -0
  65. package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.js +34 -0
  66. package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.module.css.js +9 -0
  67. package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.d.ts +1 -0
  68. package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.js +5 -0
  69. package/cjs/features/workflow/ChangeRequestEditor/components/editors/editors.module.css.js +9 -0
  70. package/cjs/features/workflow/ChangeRequestEditor/components/editors/index.d.ts +4 -0
  71. package/cjs/features/workflow/ChangeRequestEditor/components/editors/index.js +12 -0
  72. package/cjs/features/workflow/ChangeRequestEditor/helpers/addedAttributes.d.ts +11 -0
  73. package/cjs/features/workflow/ChangeRequestEditor/helpers/addedAttributes.js +74 -0
  74. package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.d.ts +2 -0
  75. package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.js +157 -0
  76. package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test.d.ts +1 -0
  77. package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test.js +203 -0
  78. package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +6 -3
  79. package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.js +22 -3
  80. package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.d.ts +3 -0
  81. package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.js +190 -0
  82. package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.d.ts +1 -0
  83. package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.js +768 -0
  84. package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +4 -3
  85. package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +9 -1
  86. package/cjs/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.d.ts +18 -0
  87. package/cjs/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.js +65 -0
  88. package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +7 -3
  89. package/cjs/features/workflow/contexts/AddedAttributesContext/index.d.ts +39 -0
  90. package/cjs/features/workflow/contexts/AddedAttributesContext/index.js +152 -0
  91. package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +3 -2
  92. package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.js +47 -7
  93. package/cjs/features/workflow/contexts/ScrollToAddedAttributeContext/index.d.ts +11 -0
  94. package/cjs/features/workflow/contexts/ScrollToAddedAttributeContext/index.js +78 -0
  95. package/cjs/features/workflow/helpers/attributes.js +16 -13
  96. package/cjs/features/workflow/helpers/attributes.test.js +6 -3
  97. package/cjs/features/workflow/helpers/dcr.d.ts +6 -1
  98. package/cjs/features/workflow/helpers/dcr.js +123 -19
  99. package/cjs/features/workflow/helpers/dcr.test.js +171 -0
  100. package/cjs/features/workflow/helpers/merge.d.ts +3 -0
  101. package/cjs/features/workflow/helpers/merge.js +32 -20
  102. package/cjs/features/workflow/helpers/merge.test.js +2 -1
  103. package/cjs/features/workflow/helpers/moreAttributesScope.d.ts +4 -0
  104. package/cjs/features/workflow/helpers/moreAttributesScope.js +20 -0
  105. package/cjs/features/workflow/helpers/validation.js +31 -6
  106. package/cjs/features/workflow/hooks/useApplyDcrChanges.d.ts +2 -2
  107. package/cjs/features/workflow/hooks/useApplyDcrChanges.js +80 -63
  108. package/cjs/features/workflow/types.d.ts +12 -2
  109. package/features/activity-log/ActivityLog/ActivityLog.test.js +28 -0
  110. package/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.js +15 -4
  111. package/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.module.css.js +9 -0
  112. package/features/activity-log/ActivityLog/constants.d.ts +17 -0
  113. package/features/activity-log/ActivityLog/constants.js +17 -0
  114. package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.d.ts +1 -1
  115. package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +20 -9
  116. package/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.d.ts +7 -0
  117. package/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.js +37 -0
  118. package/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.js +3 -1
  119. package/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.module.css.js +2 -2
  120. package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +2 -2
  121. package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +32 -10
  122. package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
  123. package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.d.ts +9 -0
  124. package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.js +49 -0
  125. package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.d.ts +1 -0
  126. package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.js +1 -0
  127. package/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +2 -2
  128. package/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.js +2 -2
  129. package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.d.ts +11 -0
  130. package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.js +34 -0
  131. package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.module.css.js +9 -0
  132. package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.d.ts +1 -0
  133. package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.js +1 -0
  134. package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.d.ts +1 -1
  135. package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +112 -6
  136. package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/SkeletonEntityChangesGroupLoader.js +1 -1
  137. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/ChangeItemEditor.d.ts +1 -1
  138. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.js +80 -0
  139. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.module.css.js +9 -0
  140. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.js +6 -5
  141. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.d.ts +0 -1
  142. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.js +0 -1
  143. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.d.ts +8 -0
  144. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.js +59 -0
  145. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.d.ts +1 -0
  146. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.js +1 -0
  147. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.d.ts +1 -1
  148. package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.js +10 -9
  149. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/ChangeItemOldValue.module.css.js +9 -0
  150. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.d.ts +1 -0
  151. package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.js +1 -0
  152. package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.d.ts +11 -0
  153. package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.js +27 -0
  154. package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.module.css.js +9 -0
  155. package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.d.ts +1 -0
  156. package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.js +1 -0
  157. package/features/workflow/ChangeRequestEditor/components/editors/editors.module.css.js +9 -0
  158. package/features/workflow/ChangeRequestEditor/components/editors/index.d.ts +4 -0
  159. package/features/workflow/ChangeRequestEditor/components/editors/index.js +4 -0
  160. package/features/workflow/ChangeRequestEditor/helpers/addedAttributes.d.ts +11 -0
  161. package/features/workflow/ChangeRequestEditor/helpers/addedAttributes.js +62 -0
  162. package/features/workflow/ChangeRequestEditor/helpers/changesList.d.ts +2 -0
  163. package/features/workflow/ChangeRequestEditor/helpers/changesList.js +153 -0
  164. package/features/workflow/ChangeRequestEditor/helpers/changesList.test.d.ts +1 -0
  165. package/features/workflow/ChangeRequestEditor/helpers/changesList.test.js +201 -0
  166. package/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +6 -3
  167. package/features/workflow/ChangeRequestEditor/helpers/helpers.js +19 -3
  168. package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.d.ts +3 -0
  169. package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.js +186 -0
  170. package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.d.ts +1 -0
  171. package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.js +766 -0
  172. package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +4 -3
  173. package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +9 -1
  174. package/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.d.ts +18 -0
  175. package/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.js +61 -0
  176. package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +7 -3
  177. package/features/workflow/contexts/AddedAttributesContext/index.d.ts +39 -0
  178. package/features/workflow/contexts/AddedAttributesContext/index.js +125 -0
  179. package/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +3 -2
  180. package/features/workflow/contexts/ChangeRequestEditorContext/index.js +47 -7
  181. package/features/workflow/contexts/ScrollToAddedAttributeContext/index.d.ts +11 -0
  182. package/features/workflow/contexts/ScrollToAddedAttributeContext/index.js +51 -0
  183. package/features/workflow/helpers/attributes.js +16 -13
  184. package/features/workflow/helpers/attributes.test.js +6 -3
  185. package/features/workflow/helpers/dcr.d.ts +6 -1
  186. package/features/workflow/helpers/dcr.js +122 -19
  187. package/features/workflow/helpers/dcr.test.js +172 -1
  188. package/features/workflow/helpers/merge.d.ts +3 -0
  189. package/features/workflow/helpers/merge.js +30 -19
  190. package/features/workflow/helpers/merge.test.js +2 -1
  191. package/features/workflow/helpers/moreAttributesScope.d.ts +4 -0
  192. package/features/workflow/helpers/moreAttributesScope.js +14 -0
  193. package/features/workflow/helpers/validation.js +31 -6
  194. package/features/workflow/hooks/useApplyDcrChanges.d.ts +2 -2
  195. package/features/workflow/hooks/useApplyDcrChanges.js +83 -66
  196. package/features/workflow/types.d.ts +12 -2
  197. package/package.json +2 -2
  198. package/cjs/features/activity-log/ActivityLog/components/ActivityItem/styles.d.ts +0 -1
  199. package/cjs/features/activity-log/ActivityLog/components/ActivityItem/styles.js +0 -57
  200. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +0 -95
  201. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.module.css.js +0 -9
  202. package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.d.ts +0 -7
  203. package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.js +0 -21
  204. package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.module.css.js +0 -9
  205. package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/index.d.ts +0 -1
  206. package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/index.js +0 -5
  207. package/features/activity-log/ActivityLog/components/ActivityItem/styles.d.ts +0 -1
  208. package/features/activity-log/ActivityLog/components/ActivityItem/styles.js +0 -54
  209. package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +0 -65
  210. package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.module.css.js +0 -9
  211. package/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.d.ts +0 -7
  212. package/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.js +0 -14
  213. package/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.module.css.js +0 -9
  214. package/features/workflow/ChangeRequestEditor/components/StatusChips/index.d.ts +0 -1
  215. package/features/workflow/ChangeRequestEditor/components/StatusChips/index.js +0 -1
  216. /package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.d.ts +0 -0
  217. /package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.d.ts +0 -0
@@ -10,7 +10,10 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { clone, has, isNil } from 'ramda';
13
- import { DCROperationTypes, DCRTypes, isRelationTypeUri, MetadataPermissions, checkMetadataPermission, isRoleAttrType, isTagAttrType, checkSubAttributesPermissions } from '@reltio/mdm-sdk';
13
+ import { DCROperationTypes, DCRTypes, isComplexAttribute, isImage, isRelationTypeUri, MetadataPermissions, checkMetadataPermission, isRoleAttrType, isTagAttrType, checkSubAttributesPermissions } from '@reltio/mdm-sdk';
14
+ export var isSimpleAttributeValue = function (value) {
15
+ return value !== null && typeof value === 'object' && 'value' in value;
16
+ };
14
17
  export var isEditableChange = function (change, entityInfo) {
15
18
  var _a;
16
19
  var currentAttributeTypeUri = (_a = change.attributeType) === null || _a === void 0 ? void 0 : _a.uri;
@@ -66,7 +69,7 @@ var addLineIdToChangeValue = function (container, basePath, type) {
66
69
  if (Array.isArray(container)) {
67
70
  return { value: container, lineIds: [basePath] };
68
71
  }
69
- if (typeof container === 'object' && 'value' in container) {
72
+ if (isSimpleAttributeValue(container)) {
70
73
  var containerValue = container.value;
71
74
  return __assign(__assign({}, container), { lineIds: [basePath], value: isPrimitiveValue(containerValue)
72
75
  ? containerValue
@@ -75,7 +78,7 @@ var addLineIdToChangeValue = function (container, basePath, type) {
75
78
  return container;
76
79
  };
77
80
  export var addLineIdToValue = function (data) {
78
- var enrichedData = clone(data);
81
+ var enrichedData = data;
79
82
  for (var entityOrRelationKey in enrichedData) {
80
83
  var entityOrRelationId = entityOrRelationKey.split('/')[1];
81
84
  var changeList = enrichedData[entityOrRelationKey];
@@ -101,6 +104,19 @@ export var addLineIdToValue = function (data) {
101
104
  export var isDiffChange = function (change) {
102
105
  return has('level', change);
103
106
  };
107
+ export var isRelationRow = function (change) { return Boolean(change.relationType); };
108
+ export var isNestedOrReferenceParent = function (change) {
109
+ var _a;
110
+ if (!change.attributeType)
111
+ return false;
112
+ if (isImage(change.attributeType))
113
+ return false;
114
+ if (!isComplexAttribute(change.attributeType))
115
+ return false;
116
+ var value = (_a = change.attributeValue) === null || _a === void 0 ? void 0 : _a.value;
117
+ var isDeleted = (value === null || value === void 0 ? void 0 : value.type) === DCRTypes.DELETE_ATTRIBUTE;
118
+ return !isDeleted;
119
+ };
104
120
  export var checkCanInitiateChangeRequest = function (metadata, entityType, change) {
105
121
  if (change.relationType) {
106
122
  return checkCanInitChangeRequestForRelation(metadata, change.attributeValue, change.relationType);
@@ -0,0 +1,3 @@
1
+ import { type DCRChanges, type EnrichedDCRChanges } from '@reltio/mdm-sdk';
2
+ import type { AddedAttribute } from '../../contexts/AddedAttributesContext';
3
+ export declare const mergeAddedAttributesWithDCRChanges: (changes: DCRChanges, addedAttributes: AddedAttribute[], enrich?: boolean) => EnrichedDCRChanges | DCRChanges;
@@ -0,0 +1,186 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { clone, path } from 'ramda';
13
+ import { DCRTypes, EntityAttrTypes, getBaseUri, isReference, isActivenessAttrType, isComplexAttribute, isImage, isRoleAttrType, isTagAttrType } from '@reltio/mdm-sdk';
14
+ import { addLineIdToValue } from './helpers';
15
+ var findNodeByLineId = function (changes, objectUri, lineId) {
16
+ var _a;
17
+ var changeList = changes[objectUri];
18
+ if (!Array.isArray(changeList))
19
+ return null;
20
+ var lineIdParts = lineId.split('/');
21
+ if (lineIdParts.length < 3)
22
+ return null;
23
+ var changeId = lineIdParts[1];
24
+ var change = changeList.find(function (c) { return c.id === changeId; });
25
+ if (!(change === null || change === void 0 ? void 0 : change.newValue))
26
+ return null;
27
+ return (_a = path(lineIdParts.slice(2), change)) !== null && _a !== void 0 ? _a : null;
28
+ };
29
+ var addChildToNode = function (parentNode, attrName, addedId, attributeType, initialValue) {
30
+ var containerKey = 'attributes' in parentNode && typeof parentNode.attributes === 'object' ? 'attributes' : 'value';
31
+ if (!parentNode[containerKey] ||
32
+ typeof parentNode[containerKey] !== 'object' ||
33
+ Array.isArray(parentNode[containerKey])) {
34
+ parentNode[containerKey] = {};
35
+ }
36
+ var container = parentNode[containerKey];
37
+ if (!Array.isArray(container[attrName])) {
38
+ container[attrName] = [];
39
+ }
40
+ var isComplex = attributeType && (isComplexAttribute(attributeType) || isImage(attributeType));
41
+ var value = isComplex ? {} : initialValue === null || initialValue === void 0 ? void 0 : initialValue.value;
42
+ var childNode = __assign(__assign({ value: value }, ((initialValue === null || initialValue === void 0 ? void 0 : initialValue.lookupCode) && { lookupCode: initialValue.lookupCode })), (addedId && { addedId: addedId }));
43
+ container[attrName].push(childNode);
44
+ return childNode;
45
+ };
46
+ var createNewValue = function (attributeType, enrich, id, refEntityUri, initialValue) {
47
+ var isComplex = isComplexAttribute(attributeType) || isImage(attributeType);
48
+ var value = isComplex ? {} : initialValue === null || initialValue === void 0 ? void 0 : initialValue.value;
49
+ var base = __assign(__assign({ value: value }, ((initialValue === null || initialValue === void 0 ? void 0 : initialValue.lookupCode) && { lookupCode: initialValue.lookupCode })), (enrich && id && { addedId: id }));
50
+ if (isReference(attributeType)) {
51
+ base.refEntity = { objectURI: refEntityUri || '' };
52
+ }
53
+ return base;
54
+ };
55
+ var createFakeInsertAttributeChange = function (id, attributeType, newValue, changeOverrides) {
56
+ return __assign({ id: id, type: DCRTypes.INSERT_ATTRIBUTE, attributePath: attributeType.name, attributeType: attributeType.uri, newValue: newValue }, changeOverrides);
57
+ };
58
+ var createFakeRolesOrTagsChange = function (id, attributeType, enrich) { return ({
59
+ id: id,
60
+ type: isTagAttrType(attributeType) ? DCRTypes.UPDATE_TAGS : DCRTypes.UPDATE_ROLES,
61
+ newValue: (enrich ? { value: [], addedId: id } : [])
62
+ }); };
63
+ var createFakeActivenessDateChange = function (id, attributeType, enrich) { return ({
64
+ id: id,
65
+ type: attributeType.uri === EntityAttrTypes.startDate.uri ? DCRTypes.UPDATE_START_DATE : DCRTypes.UPDATE_END_DATE,
66
+ objectType: getBaseUri(attributeType.uri),
67
+ newValue: (enrich ? { value: undefined, addedId: id } : [])
68
+ }); };
69
+ var createEmptyChangeValue = function (enrich, id) {
70
+ return (enrich ? { value: undefined, addedId: id } : []);
71
+ };
72
+ var upsertSpecialAttributeChange = function (_a) {
73
+ var changesList = _a.changesList, changeType = _a.changeType, change = _a.change, enrich = _a.enrich, id = _a.id;
74
+ var existingChange = changesList.find(function (c) { return c.type === changeType; });
75
+ if (existingChange && !existingChange.newValue) {
76
+ existingChange.newValue = createEmptyChangeValue(enrich, id);
77
+ }
78
+ else if (!existingChange) {
79
+ changesList.push(change);
80
+ }
81
+ };
82
+ var resolveObjectUri = function (objectUriOrId, changes) {
83
+ if (!objectUriOrId)
84
+ return undefined;
85
+ if (changes[objectUriOrId])
86
+ return objectUriOrId;
87
+ return Object.keys(changes).find(function (uri) { return uri.endsWith("/".concat(objectUriOrId)); }) || objectUriOrId;
88
+ };
89
+ var getObjectUriFromLineId = function (lineId, changes) {
90
+ var objectId = lineId.split('/')[0];
91
+ return resolveObjectUri(objectId, changes);
92
+ };
93
+ export var mergeAddedAttributesWithDCRChanges = function (changes, addedAttributes, enrich) {
94
+ var _a, _b, _c, _d;
95
+ if (enrich === void 0) { enrich = true; }
96
+ var merged = clone(changes);
97
+ if (addedAttributes.length === 0) {
98
+ return enrich ? addLineIdToValue(merged) : merged;
99
+ }
100
+ var nodeById = new Map();
101
+ for (var _i = 0, addedAttributes_1 = addedAttributes; _i < addedAttributes_1.length; _i++) {
102
+ var addedAttribute = addedAttributes_1[_i];
103
+ var id = addedAttribute.id, objectUriFromAddedAttribute = addedAttribute.objectUri, parentLineId = addedAttribute.parentLineId, parentId = addedAttribute.parentId, changeOverrides = addedAttribute.changeOverrides, attributeType = addedAttribute.attributeType;
104
+ var objectUri = resolveObjectUri(objectUriFromAddedAttribute, merged) ||
105
+ (parentLineId ? getObjectUriFromLineId(parentLineId, merged) : undefined);
106
+ var attrName = (_a = attributeType === null || attributeType === void 0 ? void 0 : attributeType.name) !== null && _a !== void 0 ? _a : '';
107
+ if (parentId && !objectUri) {
108
+ var parentNode = (_b = nodeById.get(parentId)) !== null && _b !== void 0 ? _b : null;
109
+ if (!parentNode)
110
+ continue;
111
+ var childNode = addChildToNode(parentNode, attrName, enrich ? id : undefined, attributeType, addedAttribute.initialValue);
112
+ nodeById.set(id, childNode);
113
+ continue;
114
+ }
115
+ if (!objectUri)
116
+ continue;
117
+ if (!merged[objectUri]) {
118
+ merged[objectUri] = [];
119
+ }
120
+ var createChange = !parentLineId && !parentId
121
+ ? merged[objectUri].find(function (c) { return c.type === DCRTypes.CREATE_ENTITY || c.type === DCRTypes.CREATE_RELATIONSHIP; })
122
+ : undefined;
123
+ if ((createChange === null || createChange === void 0 ? void 0 : createChange.newValue) && (isRoleAttrType(attributeType) || isTagAttrType(attributeType))) {
124
+ var parentNode = createChange.newValue;
125
+ parentNode[attrName] = enrich ? { value: [], addedId: id } : [];
126
+ }
127
+ else if ((createChange === null || createChange === void 0 ? void 0 : createChange.newValue) && isActivenessAttrType(attributeType)) {
128
+ var parentNode = createChange.newValue;
129
+ parentNode[attributeType.uri] = enrich ? { addedId: id } : null;
130
+ }
131
+ else if (createChange === null || createChange === void 0 ? void 0 : createChange.newValue) {
132
+ var parentNode = createChange.newValue;
133
+ var childNode = addChildToNode(parentNode, attrName, enrich ? id : undefined, attributeType, addedAttribute.initialValue);
134
+ nodeById.set(id, childNode);
135
+ }
136
+ else if (isActivenessAttrType(attributeType)) {
137
+ var createRelOrEntityChange = merged[objectUri].find(function (c) { return c.type === DCRTypes.CREATE_RELATIONSHIP || c.type === DCRTypes.CREATE_ENTITY; });
138
+ if (createRelOrEntityChange === null || createRelOrEntityChange === void 0 ? void 0 : createRelOrEntityChange.newValue) {
139
+ var parentNode = createRelOrEntityChange.newValue;
140
+ parentNode[attributeType.uri] = enrich ? { addedId: id } : null;
141
+ }
142
+ else {
143
+ var changeType = attributeType.uri === EntityAttrTypes.startDate.uri
144
+ ? DCRTypes.UPDATE_START_DATE
145
+ : DCRTypes.UPDATE_END_DATE;
146
+ upsertSpecialAttributeChange({
147
+ changesList: merged[objectUri],
148
+ changeType: changeType,
149
+ change: createFakeActivenessDateChange(id, attributeType, enrich),
150
+ enrich: enrich,
151
+ id: id
152
+ });
153
+ }
154
+ }
155
+ else if (isTagAttrType(attributeType) || isRoleAttrType(attributeType)) {
156
+ var changeType = isTagAttrType(attributeType) ? DCRTypes.UPDATE_TAGS : DCRTypes.UPDATE_ROLES;
157
+ upsertSpecialAttributeChange({
158
+ changesList: merged[objectUri],
159
+ changeType: changeType,
160
+ change: createFakeRolesOrTagsChange(id, attributeType, enrich),
161
+ enrich: enrich,
162
+ id: id
163
+ });
164
+ }
165
+ else if (!parentLineId && !parentId) {
166
+ var newValue = createNewValue(attributeType, enrich, id, (_c = addedAttribute.refEntity) === null || _c === void 0 ? void 0 : _c.entityUri, addedAttribute.initialValue);
167
+ nodeById.set(id, newValue);
168
+ var newChange = createFakeInsertAttributeChange(id, attributeType, newValue, changeOverrides);
169
+ merged[objectUri].push(newChange);
170
+ }
171
+ else {
172
+ var parentNode = null;
173
+ if (parentLineId) {
174
+ parentNode = findNodeByLineId(merged, objectUri, parentLineId);
175
+ }
176
+ else if (parentId) {
177
+ parentNode = (_d = nodeById.get(parentId)) !== null && _d !== void 0 ? _d : null;
178
+ }
179
+ if (!parentNode)
180
+ continue;
181
+ var childNode = addChildToNode(parentNode, attrName, enrich ? id : undefined, attributeType, addedAttribute.initialValue);
182
+ nodeById.set(id, childNode);
183
+ }
184
+ }
185
+ return enrich ? addLineIdToValue(merged) : merged;
186
+ };