@reltio/components 1.4.908 → 1.4.912

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/cjs/components/ActionButton/ActionButton.d.ts +16 -0
  2. package/cjs/components/ActionButton/ActionButton.js +90 -0
  3. package/cjs/components/ActionButton/styles.d.ts +1 -0
  4. package/cjs/components/ActionButton/styles.js +50 -0
  5. package/cjs/components/MergeButton/MergeButton.d.ts +15 -0
  6. package/cjs/components/MergeButton/MergeButton.js +64 -0
  7. package/cjs/components/NotMatchButton/NotMatchButton.d.ts +15 -0
  8. package/cjs/components/NotMatchButton/NotMatchButton.js +64 -0
  9. package/cjs/components/ProfileMatchCard/ProfileMatchCard.d.ts +2 -1
  10. package/cjs/components/ProfileMatchCard/ProfileMatchCard.js +3 -2
  11. package/cjs/components/attributes/AttributesView/AttributesView.d.ts +1 -1
  12. package/cjs/components/attributes/AttributesView/AttributesView.js +2 -2
  13. package/cjs/components/attributes/AttributesView/index.d.ts +1 -1
  14. package/cjs/components/attributes/editMode/AttributesList/AttributesList.js +3 -1
  15. package/cjs/components/attributes/editMode/AttributesPager/AttributeRenderer.js +4 -1
  16. package/cjs/components/attributes/editMode/AttributesView/AttributesView.d.ts +1 -1
  17. package/cjs/components/attributes/editMode/AttributesView/AttributesView.js +9 -2
  18. package/cjs/components/attributes/editMode/AttributesView/index.d.ts +9 -1
  19. package/cjs/components/attributes/editMode/contexts/PinnedAttributesContext.d.ts +2 -0
  20. package/cjs/components/attributes/editMode/contexts/PinnedAttributesContext.js +8 -0
  21. package/cjs/components/attributes/readMode/AttributesView/index.d.ts +8 -0
  22. package/cjs/components/attributes/types/attributesView.d.ts +4 -0
  23. package/cjs/components/history/HistoryMenuButton/HistoryMenuButton.js +46 -1
  24. package/cjs/components/history/HistoryMenuButton/MenuItemRenderer.d.ts +12 -0
  25. package/cjs/components/history/HistoryMenuButton/MenuItemRenderer.js +44 -0
  26. package/cjs/components/history/HistoryMenuButton/styles.d.ts +1 -1
  27. package/cjs/components/history/HistoryMenuButton/styles.js +13 -0
  28. package/cjs/components/index.d.ts +3 -0
  29. package/cjs/components/index.js +8 -1
  30. package/cjs/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +6 -30
  31. package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +7 -4
  32. package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.js +19 -9
  33. package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +4 -4
  34. package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/styles.js +3 -9
  35. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.d.ts +2 -2
  36. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.js +4 -1
  37. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.d.ts +1 -0
  38. package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.js +13 -0
  39. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.d.ts +2 -13
  40. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.js +25 -9
  41. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.d.ts +1 -1
  42. package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.js +14 -2
  43. package/cjs/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +1 -1
  44. package/cjs/components/workflow/components/AttributesChanges/helpers/attributesHelpers.d.ts +3 -2
  45. package/cjs/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +35 -6
  46. package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +4 -6
  47. package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.js +4 -26
  48. package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +3 -2
  49. package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +109 -28
  50. package/cjs/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.d.ts +3 -2
  51. package/cjs/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.js +4 -4
  52. package/cjs/components/workflow/components/AttributesChanges/types/diffTypes.d.ts +16 -0
  53. package/cjs/components/workflow/components/AttributesChanges/types/{DCRTypes.js → diffTypes.js} +0 -0
  54. package/cjs/components/workflow/components/LineDecorator/LineDecorator.d.ts +2 -1
  55. package/cjs/components/workflow/components/LineDecorator/LineDecorator.js +5 -2
  56. package/cjs/components/workflow/components/LineDecorator/styles.d.ts +1 -1
  57. package/cjs/components/workflow/components/LineDecorator/styles.js +4 -1
  58. package/cjs/components/workflow/{components/AttributesChanges/constants → constants}/operations.d.ts +0 -0
  59. package/cjs/components/workflow/{components/AttributesChanges/constants → constants}/operations.js +0 -0
  60. package/cjs/components/workflow/helpers/dcrHelpers.d.ts +7 -0
  61. package/cjs/components/workflow/helpers/dcrHelpers.js +48 -0
  62. package/cjs/components/workflow/hooks/useChangeRequest.d.ts +5 -0
  63. package/cjs/components/workflow/hooks/useChangeRequest.js +58 -0
  64. package/{esm/components/workflow/components/AttributesChanges/types/DCRTypes.d.ts → cjs/components/workflow/types/dcrTypes.d.ts} +22 -16
  65. package/cjs/components/workflow/types/dcrTypes.js +2 -0
  66. package/cjs/contexts/CollaborationContext/index.d.ts +1 -0
  67. package/cjs/contexts/CollaborationContext/index.js +1 -0
  68. package/cjs/hooks/index.d.ts +2 -0
  69. package/cjs/hooks/index.js +5 -1
  70. package/cjs/hooks/useCollaboration.d.ts +11 -10
  71. package/cjs/hooks/useCollaboration.js +24 -15
  72. package/cjs/hooks/useMarkAsNotMatchRequest.d.ts +12 -0
  73. package/cjs/hooks/useMarkAsNotMatchRequest.js +29 -0
  74. package/cjs/hooks/useMergeAllRequest.d.ts +12 -0
  75. package/cjs/hooks/useMergeAllRequest.js +29 -0
  76. package/esm/components/ActionButton/ActionButton.d.ts +16 -0
  77. package/esm/components/ActionButton/ActionButton.js +65 -0
  78. package/esm/components/ActionButton/styles.d.ts +1 -0
  79. package/esm/components/ActionButton/styles.js +47 -0
  80. package/esm/components/MergeButton/MergeButton.d.ts +15 -0
  81. package/esm/components/MergeButton/MergeButton.js +39 -0
  82. package/esm/components/NotMatchButton/NotMatchButton.d.ts +15 -0
  83. package/esm/components/NotMatchButton/NotMatchButton.js +39 -0
  84. package/esm/components/ProfileMatchCard/ProfileMatchCard.d.ts +2 -1
  85. package/esm/components/ProfileMatchCard/ProfileMatchCard.js +3 -2
  86. package/esm/components/attributes/AttributesView/AttributesView.d.ts +1 -1
  87. package/esm/components/attributes/AttributesView/AttributesView.js +2 -2
  88. package/esm/components/attributes/AttributesView/index.d.ts +1 -1
  89. package/esm/components/attributes/editMode/AttributesList/AttributesList.js +4 -2
  90. package/esm/components/attributes/editMode/AttributesPager/AttributeRenderer.js +5 -2
  91. package/esm/components/attributes/editMode/AttributesView/AttributesView.d.ts +1 -1
  92. package/esm/components/attributes/editMode/AttributesView/AttributesView.js +10 -3
  93. package/esm/components/attributes/editMode/AttributesView/index.d.ts +9 -1
  94. package/esm/components/attributes/editMode/contexts/PinnedAttributesContext.d.ts +2 -0
  95. package/esm/components/attributes/editMode/contexts/PinnedAttributesContext.js +2 -0
  96. package/esm/components/attributes/readMode/AttributesView/index.d.ts +8 -0
  97. package/esm/components/attributes/types/attributesView.d.ts +4 -0
  98. package/esm/components/history/HistoryMenuButton/HistoryMenuButton.js +27 -1
  99. package/esm/components/history/HistoryMenuButton/MenuItemRenderer.d.ts +12 -0
  100. package/esm/components/history/HistoryMenuButton/MenuItemRenderer.js +20 -0
  101. package/esm/components/history/HistoryMenuButton/styles.d.ts +1 -1
  102. package/esm/components/history/HistoryMenuButton/styles.js +13 -0
  103. package/esm/components/index.d.ts +3 -0
  104. package/esm/components/index.js +3 -0
  105. package/esm/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +6 -11
  106. package/esm/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +7 -4
  107. package/esm/components/workflow/components/AttributesChanges/AttributesChanges.js +19 -9
  108. package/esm/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +4 -4
  109. package/esm/components/workflow/components/AttributesChanges/components/ChangeView/styles.js +3 -9
  110. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.d.ts +2 -2
  111. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.js +4 -1
  112. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.d.ts +1 -0
  113. package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.js +10 -0
  114. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.d.ts +2 -13
  115. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.js +26 -10
  116. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.d.ts +1 -1
  117. package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.js +14 -2
  118. package/esm/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +1 -1
  119. package/esm/components/workflow/components/AttributesChanges/helpers/attributesHelpers.d.ts +3 -2
  120. package/esm/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +35 -7
  121. package/esm/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +4 -6
  122. package/esm/components/workflow/components/AttributesChanges/helpers/helpers.js +4 -25
  123. package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +3 -2
  124. package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +112 -31
  125. package/esm/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.d.ts +3 -2
  126. package/esm/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.js +4 -4
  127. package/esm/components/workflow/components/AttributesChanges/types/diffTypes.d.ts +16 -0
  128. package/esm/components/workflow/components/AttributesChanges/types/{DCRTypes.js → diffTypes.js} +0 -0
  129. package/esm/components/workflow/components/LineDecorator/LineDecorator.d.ts +2 -1
  130. package/esm/components/workflow/components/LineDecorator/LineDecorator.js +5 -2
  131. package/esm/components/workflow/components/LineDecorator/styles.d.ts +1 -1
  132. package/esm/components/workflow/components/LineDecorator/styles.js +4 -1
  133. package/esm/components/workflow/{components/AttributesChanges/constants → constants}/operations.d.ts +0 -0
  134. package/esm/components/workflow/{components/AttributesChanges/constants → constants}/operations.js +0 -0
  135. package/esm/components/workflow/helpers/dcrHelpers.d.ts +7 -0
  136. package/esm/components/workflow/helpers/dcrHelpers.js +43 -0
  137. package/esm/components/workflow/hooks/useChangeRequest.d.ts +5 -0
  138. package/esm/components/workflow/hooks/useChangeRequest.js +54 -0
  139. package/{cjs/components/workflow/components/AttributesChanges/types/DCRTypes.d.ts → esm/components/workflow/types/dcrTypes.d.ts} +22 -16
  140. package/esm/components/workflow/types/dcrTypes.js +1 -0
  141. package/esm/contexts/CollaborationContext/index.d.ts +1 -0
  142. package/esm/contexts/CollaborationContext/index.js +1 -0
  143. package/esm/hooks/index.d.ts +2 -0
  144. package/esm/hooks/index.js +2 -0
  145. package/esm/hooks/useCollaboration.d.ts +11 -10
  146. package/esm/hooks/useCollaboration.js +25 -16
  147. package/esm/hooks/useMarkAsNotMatchRequest.d.ts +12 -0
  148. package/esm/hooks/useMarkAsNotMatchRequest.js +22 -0
  149. package/esm/hooks/useMergeAllRequest.d.ts +12 -0
  150. package/esm/hooks/useMergeAllRequest.js +22 -0
  151. package/package.json +3 -3
@@ -1,7 +1,18 @@
1
- import { concat, curry, difference, identity, is, isNil, omit, pick, propEq, pipe, reduce } from 'ramda';
2
- import { generateTempUri, getRoleLabel, isEmptyValue, EntityAttrTypes } from '@reltio/mdm-sdk';
3
- import { DCRTypes } from '../constants/operations';
4
- import { getChanges } from './attributesHelpers';
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 { concat, curry, difference, flatten, identity, isNil, omit, pick, pipe, propEq, propOr, reduce } from 'ramda';
13
+ import { EntityAttrTypes, generateTempUri, getRoleLabel, isEmptyValue } from '@reltio/mdm-sdk';
14
+ import { DCRTypes } from '../../../constants/operations';
15
+ import { getEntityChanges, getRelationChanges } from './attributesHelpers';
5
16
  var ATTRIBUTE_DELIMITER = '/';
6
17
  var SPECIAL_ATTRIBUTES_NAMES = [
7
18
  'defaultProfilePicValue',
@@ -12,31 +23,37 @@ var SPECIAL_ATTRIBUTES_NAMES = [
12
23
  ];
13
24
  var prepareStartOrEndDate = function (_a) {
14
25
  var newValue = _a.newValue, oldValue = _a.oldValue;
15
- var parseValue = function (value) { return (is(String) ? parseInt(value) : value); };
26
+ var parseValue = function (value) { return (isNaN(value) ? value : parseInt(value)); };
16
27
  var isExistedValue = function (value) { return (value === null || value === void 0 ? void 0 : value.length) && !isEmptyValue(value); };
17
28
  var isExistNewValue = isExistedValue(newValue);
18
29
  var isExistOldValue = isExistedValue(oldValue);
19
30
  if (isExistNewValue && isExistOldValue) {
20
- return {
21
- type: DCRTypes.UPDATE_ATTRIBUTE,
22
- oldValue: { value: parseValue(oldValue[0]) },
23
- newValue: { value: parseValue(newValue[0]) }
24
- };
31
+ return [
32
+ {
33
+ type: DCRTypes.UPDATE_ATTRIBUTE,
34
+ oldValue: { value: parseValue(oldValue[0]) },
35
+ newValue: { value: parseValue(newValue[0]) }
36
+ }
37
+ ];
25
38
  }
26
39
  else if (isExistNewValue) {
27
- return {
28
- type: DCRTypes.INSERT_ATTRIBUTE,
29
- newValue: { value: parseValue(newValue[0]) }
30
- };
40
+ return [
41
+ {
42
+ type: DCRTypes.INSERT_ATTRIBUTE,
43
+ newValue: { value: parseValue(newValue[0]) }
44
+ }
45
+ ];
31
46
  }
32
47
  else if (isExistOldValue) {
33
- return {
34
- type: DCRTypes.DELETE_ATTRIBUTE,
35
- oldValue: { value: parseValue(oldValue[0]) }
36
- };
48
+ return [
49
+ {
50
+ type: DCRTypes.DELETE_ATTRIBUTE,
51
+ oldValue: { value: parseValue(oldValue[0]) }
52
+ }
53
+ ];
37
54
  }
38
55
  };
39
- var prepareRolesOrTags = function (change, metadata) {
56
+ var prepareRolesOrTags = function (metadata, change) {
40
57
  var _a = change.newValue, newValue = _a === void 0 ? [] : _a, _b = change.oldValue, oldValue = _b === void 0 ? [] : _b, type = change.type;
41
58
  var getLabel = type === DCRTypes.UPDATE_ROLES ? getRoleLabel(metadata) : identity;
42
59
  var diffNewValue = difference(newValue, oldValue);
@@ -88,6 +105,47 @@ var prepareAttribute = function (container, change) {
88
105
  }
89
106
  return container;
90
107
  };
108
+ var createEntityOrRelation = function (metadata, value) {
109
+ var _a = value.attributes, attributes = _a === void 0 ? {} : _a, startDate = value.startDate, endDate = value.endDate;
110
+ var _b = value, roles = _b.roles, tags = _b.tags, defaultProfilePicValue = _b.defaultProfilePicValue;
111
+ var newObject = __assign({}, attributes);
112
+ if (defaultProfilePicValue) {
113
+ newObject['defaultProfilePicValue'] = [defaultProfilePicValue];
114
+ }
115
+ if (roles) {
116
+ newObject[EntityAttrTypes.roles.name] = [
117
+ {
118
+ type: DCRTypes.INSERT_ATTRIBUTE,
119
+ newValue: { value: roles.map(getRoleLabel(metadata)).join(', ') }
120
+ }
121
+ ];
122
+ }
123
+ if (tags) {
124
+ newObject[EntityAttrTypes.tags.name] = [
125
+ {
126
+ type: DCRTypes.INSERT_ATTRIBUTE,
127
+ newValue: { value: tags.join(', ') }
128
+ }
129
+ ];
130
+ }
131
+ if (startDate) {
132
+ newObject[EntityAttrTypes.startDate.name] = [
133
+ {
134
+ type: DCRTypes.INSERT_ATTRIBUTE,
135
+ newValue: { value: startDate }
136
+ }
137
+ ];
138
+ }
139
+ if (endDate) {
140
+ newObject[EntityAttrTypes.endDate.name] = [
141
+ {
142
+ type: DCRTypes.INSERT_ATTRIBUTE,
143
+ newValue: { value: endDate }
144
+ }
145
+ ];
146
+ }
147
+ return newObject;
148
+ };
91
149
  var mergeAttributesInChange = function (metadata, objectInfo, change, container) {
92
150
  if (container === void 0) { container = {}; }
93
151
  var type = change.type;
@@ -96,39 +154,62 @@ var mergeAttributesInChange = function (metadata, objectInfo, change, container)
96
154
  container['defaultProfilePicValue'] = [change.newValue];
97
155
  break;
98
156
  case DCRTypes.UPDATE_TAGS:
99
- container[EntityAttrTypes.tags.name] = prepareRolesOrTags(change, metadata);
157
+ container[EntityAttrTypes.tags.name] = prepareRolesOrTags(metadata, change);
100
158
  break;
101
159
  case DCRTypes.UPDATE_ROLES: {
102
- container[EntityAttrTypes.roles.name] = prepareRolesOrTags(change, metadata);
160
+ container[EntityAttrTypes.roles.name] = prepareRolesOrTags(metadata, change);
103
161
  break;
104
162
  }
105
163
  case DCRTypes.UPDATE_START_DATE:
106
- container[EntityAttrTypes.startDate.name] = [prepareStartOrEndDate(change)];
164
+ container[EntityAttrTypes.startDate.name] = prepareStartOrEndDate(change);
107
165
  break;
108
166
  case DCRTypes.UPDATE_END_DATE:
109
- container[EntityAttrTypes.endDate.name] = [prepareStartOrEndDate(change)];
167
+ container[EntityAttrTypes.endDate.name] = prepareStartOrEndDate(change);
110
168
  break;
111
- default: {
169
+ case DCRTypes.CREATE_RELATIONSHIP:
170
+ case DCRTypes.CREATE_ENTITY: {
171
+ return __assign(__assign({}, container), createEntityOrRelation(metadata, change.newValue));
172
+ }
173
+ case DCRTypes.INSERT_ATTRIBUTE:
174
+ case DCRTypes.UPDATE_ATTRIBUTE:
175
+ case DCRTypes.DELETE_ATTRIBUTE:
176
+ case DCRTypes.PIN_ATTRIBUTE:
177
+ case DCRTypes.IGNORE_ATTRIBUTE:
112
178
  prepareAttribute(container, change);
113
179
  break;
114
- }
180
+ default:
181
+ break;
115
182
  }
116
183
  return container;
117
184
  };
118
- var mergeChanges = function (metadata, changes, objectInfo) {
119
- var getAttributeChanges = function (attributeName) { return pipe(pick([attributeName]), getChanges(metadata, objectInfo)); };
185
+ var updateRelation = function (metadata, changes, relationInfo) {
186
+ var relationChanges = propOr([], relationInfo.uri)(changes);
187
+ return relationChanges.reduce(function (result, change) {
188
+ return mergeAttributesInChange(metadata, relationInfo, change, result);
189
+ }, {});
190
+ };
191
+ var mergeChanges = function (metadata, changes, entityInfo, relationsInfo) {
192
+ var getAttributeChanges = function (attributeName) {
193
+ return pipe(pick([attributeName]), getEntityChanges(metadata, entityInfo));
194
+ };
120
195
  var concatChanges = curry(function (getters, attributesTree) {
121
196
  return reduce(function (acc, getter) { return concat(acc, getter(attributesTree)); }, [], getters);
122
197
  });
123
- var changesTree = changes.reduce(function (result, change) {
124
- return mergeAttributesInChange(metadata, objectInfo, change, result);
198
+ var entityInfoChanges = propOr([], entityInfo.uri)(changes);
199
+ var changesTree = entityInfoChanges.reduce(function (result, change) {
200
+ return mergeAttributesInChange(metadata, entityInfo, change, result);
125
201
  }, {});
126
- return concatChanges([
127
- pipe(omit(SPECIAL_ATTRIBUTES_NAMES), getChanges(metadata, objectInfo)),
202
+ var relationsTrees = relationsInfo.map(function (relationInfo) { return updateRelation(metadata, changes, relationInfo); });
203
+ var entityChanges = concatChanges([
204
+ pipe(omit(SPECIAL_ATTRIBUTES_NAMES), getEntityChanges(metadata, entityInfo)),
128
205
  getAttributeChanges(EntityAttrTypes.roles.name),
129
206
  getAttributeChanges(EntityAttrTypes.tags.name),
130
207
  getAttributeChanges(EntityAttrTypes.startDate.name),
131
208
  getAttributeChanges(EntityAttrTypes.endDate.name)
132
209
  ], changesTree);
210
+ var relationsChanges = flatten(relationsInfo.map(function (relationInfo, index) {
211
+ return getRelationChanges(metadata, relationInfo, relationsTrees[index]);
212
+ }));
213
+ return [entityChanges, relationsChanges];
133
214
  };
134
215
  export { mergeChanges };
@@ -1,6 +1,7 @@
1
- export declare const useCollapsibleList: (changes: any, limit?: number) => {
1
+ import { Diff, Title } from '../types/diffTypes';
2
+ export declare const useCollapsibleList: (items: (Diff | Title)[], limit?: number) => {
2
3
  isExpanded: boolean;
3
4
  onToggle: () => void;
4
- itemsToShow: any;
5
+ itemsToShow: (Diff | Title)[];
5
6
  collapsedSuggestionsCount: number;
6
7
  };
@@ -1,14 +1,14 @@
1
1
  import { useCallback, useMemo, useState } from 'react';
2
2
  import { getSuggestionsCount } from '../helpers/contextHelpers';
3
3
  var DEFAULT_VISIBLE_ITEMS_COUNT = 3;
4
- export var useCollapsibleList = function (changes, limit) {
4
+ export var useCollapsibleList = function (items, limit) {
5
5
  if (limit === void 0) { limit = DEFAULT_VISIBLE_ITEMS_COUNT; }
6
6
  var _a = useState(false), isExpanded = _a[0], setIsExpanded = _a[1];
7
7
  var onToggle = useCallback(function () { return setIsExpanded(function (value) { return !value; }); }, []);
8
- var collapsedItems = useMemo(function () { return changes.slice(0, limit); }, [changes, limit]);
9
- var suggestionsCount = useMemo(function () { return getSuggestionsCount(changes); }, [changes]);
8
+ var collapsedItems = useMemo(function () { return items.slice(0, limit); }, [items, limit]);
9
+ var suggestionsCount = useMemo(function () { return getSuggestionsCount(items); }, [items]);
10
10
  var visibleSuggestionsCount = useMemo(function () { return getSuggestionsCount(collapsedItems); }, [collapsedItems]);
11
- var itemsToShow = isExpanded ? changes : collapsedItems;
11
+ var itemsToShow = isExpanded ? items : collapsedItems;
12
12
  var collapsedSuggestionsCount = suggestionsCount - visibleSuggestionsCount;
13
13
  return { isExpanded: isExpanded, onToggle: onToggle, itemsToShow: itemsToShow, collapsedSuggestionsCount: collapsedSuggestionsCount };
14
14
  };
@@ -0,0 +1,16 @@
1
+ import { AttributeType } from '@reltio/mdm-sdk';
2
+ import { ChangeValue, DCRAttributeValue, RelationInfo } from '../../../types/dcrTypes';
3
+ import { OperationTypes } from '../../../constants/operations';
4
+ export declare type RelationAttributeValue = DCRAttributeValue & RelationInfo;
5
+ export declare type Diff = {
6
+ level: number;
7
+ label: string;
8
+ attributeType: AttributeType;
9
+ attributeValue?: DCRAttributeValue | RelationAttributeValue;
10
+ newValue?: ChangeValue;
11
+ oldValue?: ChangeValue;
12
+ operation?: OperationTypes;
13
+ };
14
+ export declare type Title = {
15
+ label: string;
16
+ };
@@ -6,6 +6,7 @@ declare type Props = {
6
6
  first?: boolean;
7
7
  last?: boolean;
8
8
  transparent?: boolean;
9
+ divider?: boolean;
9
10
  };
10
- declare const LineDecorator: ({ className, children, plain, first, last, transparent }: Props) => JSX.Element;
11
+ declare const LineDecorator: ({ className, children, plain, first, last, transparent, divider }: Props) => JSX.Element;
11
12
  export default LineDecorator;
@@ -1,14 +1,17 @@
1
1
  import React from 'react';
2
2
  import classnames from 'classnames';
3
3
  import { useStyles } from './styles';
4
+ import Divider from '@material-ui/core/Divider';
4
5
  var LineDecorator = function (_a) {
5
6
  var _b, _c, _d;
6
- var className = _a.className, children = _a.children, plain = _a.plain, first = _a.first, last = _a.last, transparent = _a.transparent;
7
+ var className = _a.className, children = _a.children, plain = _a.plain, first = _a.first, last = _a.last, transparent = _a.transparent, divider = _a.divider;
7
8
  var styles = useStyles();
8
9
  return (React.createElement("div", { className: classnames(className, styles.decorator) },
9
10
  React.createElement("div", { className: classnames(styles.lineBlock, (_b = {}, _b[styles.withLinePadding] = first, _b)) }, !transparent && (React.createElement(React.Fragment, null,
10
11
  React.createElement("div", { className: styles.noLine }),
11
12
  React.createElement("div", { className: classnames(styles.line, (_c = {}, _c[styles.plain] = plain, _c), (_d = {}, _d[styles.last] = last, _d)) })))),
12
- React.createElement("div", { className: styles.content }, children)));
13
+ React.createElement("div", { className: styles.content },
14
+ children,
15
+ divider && React.createElement(Divider, { className: styles.rowDivider, light: true, variant: "inset" }))));
13
16
  };
14
17
  export default LineDecorator;
@@ -1 +1 @@
1
- export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"content" | "last" | "line" | "decorator" | "plain" | "lineBlock" | "withLinePadding" | "noLine">;
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"content" | "last" | "line" | "rowDivider" | "decorator" | "plain" | "lineBlock" | "withLinePadding" | "noLine">;
@@ -57,5 +57,8 @@ export var useStyles = makeStyles({
57
57
  minWidth: 0
58
58
  },
59
59
  plain: {},
60
- last: {}
60
+ last: {},
61
+ rowDivider: {
62
+ marginLeft: 0
63
+ }
61
64
  });
@@ -0,0 +1,7 @@
1
+ import { GroupedObjectsInfo, DCRChanges, DCRObjectInfo, DCRObjectsInfo } from '../types/dcrTypes';
2
+ export declare const getEntitiesObjects: any;
3
+ export declare const getRelationsObjects: any;
4
+ export declare const extractObjectsFromChangeRequest: (changes: DCRChanges, objectsInfo: DCRObjectsInfo) => DCRObjectInfo[];
5
+ export declare const createEntityRelationsObjectByEntity: any;
6
+ export declare const createEntityRelationsObjectByRelation: any;
7
+ export declare const concatEntityRelationsObjects: (acc: Record<string, GroupedObjectsInfo>, object: GroupedObjectsInfo) => Record<string, GroupedObjectsInfo>;
@@ -0,0 +1,43 @@
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 { isEntityUri, isRelationUri } from '@reltio/mdm-sdk';
13
+ import { allPass, concat, curry, equals, filter, keys, map, pathOr, pipe, prop, uniq } from 'ramda';
14
+ export var getEntitiesObjects = filter(pipe(prop('uri'), isEntityUri));
15
+ export var getRelationsObjects = filter(pipe(prop('uri'), isRelationUri));
16
+ var getRelations = function (objectsWithChanges, entityUri) {
17
+ return filter(allPass([pipe(prop('uri'), isRelationUri), pipe(prop('startObjectUri'), equals(entityUri))]))(objectsWithChanges);
18
+ };
19
+ export var extractObjectsFromChangeRequest = function (changes, objectsInfo) {
20
+ var getChange = function (key) { return prop([key], changes); };
21
+ return pipe(keys, filter(getChange), map(function (key) { return (__assign(__assign({}, objectsInfo[key]), { uri: key })); }))(objectsInfo);
22
+ };
23
+ export var createEntityRelationsObjectByEntity = curry(function (objectsWithChanges, entity) {
24
+ return {
25
+ entity: entity,
26
+ relations: getRelations(objectsWithChanges, entity.uri)
27
+ };
28
+ });
29
+ export var createEntityRelationsObjectByRelation = curry(function (objectsInfo, relation) {
30
+ var entity = objectsInfo[relation.startObjectUri];
31
+ var relations = [relation];
32
+ return entity ? { entity: __assign(__assign({}, entity), { uri: relation.startObjectUri }), relations: relations } : { relations: relations };
33
+ });
34
+ export var concatEntityRelationsObjects = function (acc, object) {
35
+ var entity = object.entity, relations = object.relations;
36
+ var entityUri = entity.uri;
37
+ var mergedRelations = pipe(pathOr([], [entityUri, 'relations']), concat(relations), uniq)(acc);
38
+ acc[entityUri] = {
39
+ entity: entity,
40
+ relations: mergedRelations
41
+ };
42
+ return acc;
43
+ };
@@ -0,0 +1,5 @@
1
+ import { GroupedObjectsInfo, ChangeRequest } from '../types/dcrTypes';
2
+ export declare const useChangeRequest: (dcrUri: string) => {
3
+ dcr: ChangeRequest;
4
+ groupedObjects: GroupedObjectsInfo[];
5
+ };
@@ -0,0 +1,54 @@
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 { useCallback, useEffect, useState } from 'react';
13
+ import { flatten, has, isEmpty, map, partition, path, pipe, reduce, values } from 'ramda';
14
+ import { getDataChangeRequest, getEntitiesByUris } from '@reltio/mdm-sdk';
15
+ import { useSafePromise } from '../../../hooks';
16
+ import { concatEntityRelationsObjects, createEntityRelationsObjectByEntity, createEntityRelationsObjectByRelation, extractObjectsFromChangeRequest, getEntitiesObjects, getRelationsObjects } from '../helpers/dcrHelpers';
17
+ import { showWorkflowError } from '../helpers/errors';
18
+ export var useChangeRequest = function (dcrUri) {
19
+ var _a = useState([]), groupedObjects = _a[0], setGroupedObjects = _a[1];
20
+ var _b = useState(null), dcr = _b[0], setDcr = _b[1];
21
+ var safePromise = useSafePromise();
22
+ var requestEntities = useCallback(function (entityUris) {
23
+ if (isEmpty(entityUris)) {
24
+ return Promise.resolve([]);
25
+ }
26
+ return safePromise(getEntitiesByUris(entityUris, { searchOptions: 'ovOnly', defaultMaxValues: 1 }));
27
+ }, []); // eslint-disable-line
28
+ useEffect(function () {
29
+ getDataChangeRequest(dcrUri)
30
+ .then(function (dcr) {
31
+ var changes = dcr.changes, objectsInfo = dcr.objectsInfo;
32
+ var objectsWithChanges = extractObjectsFromChangeRequest(changes, objectsInfo);
33
+ var entityObjectsWithRelations = pipe(getEntitiesObjects, map(createEntityRelationsObjectByEntity(objectsWithChanges)))(objectsWithChanges);
34
+ var relationsObjects = pipe(getRelationsObjects, map(createEntityRelationsObjectByRelation(objectsInfo)))(objectsWithChanges);
35
+ var _a = partition(has('entity'), relationsObjects), relationsObjectsWithEntity = _a[0], relationsObjectsWithoutEntity = _a[1];
36
+ var entityUris = relationsObjectsWithoutEntity.map(path(['relations', 0, 'startObjectUri']));
37
+ requestEntities(entityUris)
38
+ .then(function (entities) {
39
+ var relationsObjectsWithRequestedEntities = relationsObjectsWithoutEntity.map(function (relationsObject, index) {
40
+ return __assign(__assign({}, relationsObject), { entity: entities[index] });
41
+ });
42
+ pipe(flatten, reduce(concatEntityRelationsObjects, {}), values, setGroupedObjects)([
43
+ entityObjectsWithRelations,
44
+ relationsObjectsWithEntity,
45
+ relationsObjectsWithRequestedEntities
46
+ ]);
47
+ })
48
+ .catch(showWorkflowError);
49
+ setDcr(dcr);
50
+ })
51
+ .catch(showWorkflowError);
52
+ }, [dcrUri, requestEntities]);
53
+ return { dcr: dcr, groupedObjects: groupedObjects };
54
+ };
@@ -1,10 +1,26 @@
1
- import { Crosswalk, NestedAttributeValue, ReferenceAttributeValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
1
+ import { Crosswalk, Entity, NestedAttributeValue, ReferenceAttributeValue, Relation, SimpleAttributeValue } from '@reltio/mdm-sdk';
2
2
  import { DCRTypes } from '../constants/operations';
3
+ export declare type ChangeRequest = {
4
+ changes: DCRChanges;
5
+ createdBy: string;
6
+ createdTime: number;
7
+ objectsInfo: DCRObjectsInfo;
8
+ state: string;
9
+ type: string;
10
+ updatedBy: string;
11
+ updatedTime: number;
12
+ uri: string;
13
+ };
14
+ export declare type GroupedObjectsInfo = {
15
+ entity: EntityInfo;
16
+ relations: RelationInfo[];
17
+ };
3
18
  export declare type EntityInfo = {
4
19
  isExist: boolean;
5
20
  label: string;
6
21
  secondaryLabel: string;
7
22
  type: string;
23
+ uri?: string;
8
24
  };
9
25
  export declare type RelationInfo = {
10
26
  type: string;
@@ -13,11 +29,15 @@ export declare type RelationInfo = {
13
29
  endObjectLabel: string;
14
30
  endObjectUri: string;
15
31
  isExist: boolean;
32
+ uri?: string;
16
33
  };
17
34
  export declare type DCRObjectInfo = EntityInfo | RelationInfo;
18
35
  export declare type DCRObjectsInfo = {
19
36
  [key: string]: DCRObjectInfo;
20
37
  };
38
+ export declare type DCRAttributes = {
39
+ [attributeName: string]: (ChangeValue | DCRChange)[];
40
+ };
21
41
  export declare type Value = DCRAttributes | DCRChange | string | boolean | number;
22
42
  export declare type DCRAttributeValue = Omit<SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue, 'uri' | 'value'> & {
23
43
  value: Value;
@@ -27,10 +47,7 @@ export declare type DCRAttributeValue = Omit<SimpleAttributeValue | NestedAttrib
27
47
  };
28
48
  uri?: string;
29
49
  };
30
- export declare type DCRAttributes = {
31
- [attributeName: string]: DCRAttributeValue[];
32
- };
33
- export declare type ChangeValue = DCRAttributeValue | string[];
50
+ export declare type ChangeValue = DCRAttributeValue | string[] | Entity | Relation;
34
51
  export declare type DCRChange = {
35
52
  attributePath?: string;
36
53
  attributeType?: string;
@@ -50,14 +67,3 @@ export declare type DCRChange = {
50
67
  export declare type DCRChanges = {
51
68
  [key: string]: DCRChange[];
52
69
  };
53
- export declare type ChangeRequest = {
54
- changes: DCRChanges;
55
- createdBy: string;
56
- createdTime: number;
57
- objectsInfo: DCRObjectsInfo;
58
- state: string;
59
- type: string;
60
- updatedBy: string;
61
- updatedTime: number;
62
- uri: string;
63
- };
@@ -0,0 +1 @@
1
+ export {};
@@ -6,6 +6,7 @@ export declare const CollaborationContext: React.Context<{
6
6
  comments: Comment[];
7
7
  currentComment: Comment;
8
8
  getComments: (uri: string, pageToken?: string) => void;
9
+ getCommentsCount: (objectIds: string[]) => void;
9
10
  getComment: (commentId: Comment['commentId']) => void;
10
11
  createComment: (params: Pick<Comment, 'content' | 'namedUsers' | 'objectType' | 'relatedObjectUris'> & {
11
12
  uri: string;
@@ -6,6 +6,7 @@ export var CollaborationContext = React.createContext({
6
6
  currentComment: null,
7
7
  getComment: noop,
8
8
  getComments: function () { return new Promise(noop); },
9
+ getCommentsCount: noop,
9
10
  createComment: function () { return new Promise(noop); },
10
11
  editComment: function () { return new Promise(noop); },
11
12
  createReply: function () { return new Promise(noop); },
@@ -13,3 +13,5 @@ export { useWhyDidYouUpdate } from './useWhyDidYouUpdate';
13
13
  export { useConfigPermissions } from './useConfigPermissions';
14
14
  export { useMatchesLoader } from './useMatchesLoader';
15
15
  export { usePagingSimulator } from './usePagingSimulator';
16
+ export { useMergeAllRequest } from './useMergeAllRequest';
17
+ export { useMarkAsNotMatchRequest } from './useMarkAsNotMatchRequest';
@@ -13,3 +13,5 @@ export { useWhyDidYouUpdate } from './useWhyDidYouUpdate';
13
13
  export { useConfigPermissions } from './useConfigPermissions';
14
14
  export { useMatchesLoader } from './useMatchesLoader';
15
15
  export { usePagingSimulator } from './usePagingSimulator';
16
+ export { useMergeAllRequest } from './useMergeAllRequest';
17
+ export { useMarkAsNotMatchRequest } from './useMarkAsNotMatchRequest';
@@ -1,19 +1,20 @@
1
1
  import { CollaborationObjectTypes, Comment, CommentsMap } from '@reltio/mdm-sdk';
2
2
  export declare const useCollaboration: (objectIds?: string[], objectTypes?: CollaborationObjectTypes[]) => {
3
- commentsMap: CommentsMap;
4
- currentComment: Comment;
3
+ clearCurrentComment: () => void;
5
4
  comments: Comment[];
6
- getComment: (commentId: string) => void;
5
+ commentsMap: CommentsMap;
6
+ createComment: ({ content, namedUsers, objectType, uri, relatedObjectUris }: any) => Promise<void>;
7
7
  createReply: ({ content, namedUsers, commentId, action, uri }: any) => Promise<void>;
8
- editComment: ({ content, namedUsers, objectType, uri, relatedObjectUris, commentId, replies }: any) => Promise<void>;
8
+ currentComment: Comment;
9
9
  deleteComment: ({ uri, commentId }: any) => void;
10
- createComment: ({ content, namedUsers, objectType, uri, relatedObjectUris }: any) => Promise<void>;
11
- clearCurrentComment: () => void;
12
- resolveThread: ({ commentId, uri }: any) => void;
13
- reOpenThread: ({ commentId, uri }: any) => void;
14
- sending: boolean;
10
+ editComment: ({ content, namedUsers, objectType, uri, relatedObjectUris, commentId, replies }: any) => Promise<void>;
11
+ getComment: (commentId: string) => void;
12
+ getComments: (relatedObjectUri: string, pageToken?: string) => void;
13
+ getCommentsCount: (objectIds: string[], shouldResetCommentsMap?: any) => void;
15
14
  loading: boolean;
16
15
  objectTypes: CollaborationObjectTypes[];
17
- getComments: (relatedObjectUri: string, pageToken?: string) => void;
18
16
  pageToken: string;
17
+ reOpenThread: ({ commentId, uri }: any) => void;
18
+ resolveThread: ({ commentId, uri }: any) => void;
19
+ sending: boolean;
19
20
  };
@@ -17,7 +17,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
17
17
  import { useCallback, useEffect, useState } from 'react';
18
18
  import { useSelector } from 'react-redux';
19
19
  import { andThen, fromPairs, map, otherwise, pipe, props, uniqBy, prop, propEq, when, always } from 'ramda';
20
- import { createComment as createCommentRequest, createReply as createReplyRequest, getComment as getCommentRequest, getCommentsCount, updateComment as updateCommentRequest, deleteComment as deleteCommentRequest, getComments as getCommentsRequest, isTempUri } from '@reltio/mdm-sdk';
20
+ import { createComment as createCommentRequest, createReply as createReplyRequest, getComment as getCommentRequest, getCommentsCount as getCommentsCountRequest, updateComment as updateCommentRequest, deleteComment as deleteCommentRequest, getComments as getCommentsRequest, isTempUri } from '@reltio/mdm-sdk';
21
21
  import mdm from '@reltio/mdm-module';
22
22
  var defaultObjectIds = [];
23
23
  var catchErrorInRequest = function (e) { return console.error('Collaboration error', e); };
@@ -33,18 +33,26 @@ export var useCollaboration = function (objectIds, objectTypes) {
33
33
  var _d = useState(null), currentComment = _d[0], setCurrentComment = _d[1];
34
34
  var _e = useState(false), sending = _e[0], setSending = _e[1];
35
35
  var _f = useState(false), loading = _f[0], setLoading = _f[1];
36
- useEffect(function () {
37
- if (isCollaborationEnabled && entity && !isTempUri(entity.uri)) {
36
+ var addCommentsToCommentsMap = useCallback(function (commentsMap) {
37
+ setCommentsMap(function (currentCommentsMap) { return (__assign(__assign({}, currentCommentsMap), commentsMap)); });
38
+ }, []);
39
+ var entityUri = entity === null || entity === void 0 ? void 0 : entity.uri;
40
+ var getCommentsCount = useCallback(function (objectIds, shouldResetCommentsMap) {
41
+ if (shouldResetCommentsMap === void 0) { shouldResetCommentsMap = false; }
42
+ if (isCollaborationEnabled && entityUri && !isTempUri(entityUri)) {
38
43
  var onError = function (e) {
39
44
  console.warn('Collaboration error', e);
40
45
  setCommentsMap(null);
41
46
  };
42
- pipe(getCommentsCount, andThen(map(props(['objectId', 'comments']))), andThen(fromPairs), andThen(setCommentsMap), otherwise(onError))({ uris: objectIds, tenant: tenant, collaborationPath: collaborationPath });
47
+ pipe(getCommentsCountRequest, andThen(map(props(['objectId', 'comments']))), andThen(fromPairs), andThen(shouldResetCommentsMap ? setCommentsMap : addCommentsToCommentsMap), otherwise(onError))({ uris: objectIds, tenant: tenant, collaborationPath: collaborationPath });
43
48
  }
44
49
  else {
45
50
  setCommentsMap(null);
46
51
  }
47
- }, [entity, isCollaborationEnabled, tenant, collaborationPath, objectIds]);
52
+ }, [addCommentsToCommentsMap, collaborationPath, entityUri, isCollaborationEnabled, tenant]);
53
+ useEffect(function () {
54
+ getCommentsCount(objectIds, true);
55
+ }, [objectIds, getCommentsCount]);
48
56
  var getComments = useCallback(function (relatedObjectUri, pageToken) {
49
57
  getCommentsRequest({ collaborationPath: collaborationPath, tenant: tenant, relatedObjectUri: relatedObjectUri, pageToken: pageToken })
50
58
  .then(function (_a) {
@@ -198,21 +206,22 @@ export var useCollaboration = function (objectIds, objectTypes) {
198
206
  setCurrentComment(null);
199
207
  }, []);
200
208
  return {
201
- commentsMap: commentsMap,
202
- currentComment: currentComment,
209
+ clearCurrentComment: clearCurrentComment,
203
210
  comments: comments,
204
- getComment: getComment,
211
+ commentsMap: commentsMap,
212
+ createComment: createComment,
205
213
  createReply: createReply,
206
- editComment: editComment,
214
+ currentComment: currentComment,
207
215
  deleteComment: deleteComment,
208
- createComment: createComment,
209
- clearCurrentComment: clearCurrentComment,
210
- resolveThread: resolveThread,
211
- reOpenThread: reOpenThread,
212
- sending: sending,
216
+ editComment: editComment,
217
+ getComment: getComment,
218
+ getComments: getComments,
219
+ getCommentsCount: getCommentsCount,
213
220
  loading: loading,
214
221
  objectTypes: objectTypes,
215
- getComments: getComments,
216
- pageToken: pageToken
222
+ pageToken: pageToken,
223
+ reOpenThread: reOpenThread,
224
+ resolveThread: resolveThread,
225
+ sending: sending
217
226
  };
218
227
  };
@@ -0,0 +1,12 @@
1
+ import { Entity } from '@reltio/mdm-sdk';
2
+ declare type Props = {
3
+ entities: Entity[];
4
+ entity: Entity;
5
+ onFinishRequest?: () => void;
6
+ onStartRequest?: () => void;
7
+ };
8
+ export declare const useMarkAsNotMatchRequest: ({ entities, entity, onFinishRequest, onStartRequest }: Props) => {
9
+ isPending: boolean;
10
+ sendMarkAsNotMatchRequest: () => void;
11
+ };
12
+ export {};