@reltio/components 1.4.807 → 1.4.811

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 (88) hide show
  1. package/components/CollaborationItem/CollaborationItem.js +9 -2
  2. package/components/CollaborationItem/Comment/Comment.d.ts +2 -1
  3. package/components/CollaborationItem/Comment/Comment.js +11 -7
  4. package/components/CollaborationItem/SendMessageArea/SendMessageArea.d.ts +4 -2
  5. package/components/CollaborationItem/SendMessageArea/SendMessageArea.js +63 -26
  6. package/components/CollaborationItem/TextFieldWithMentions/styles.js +1 -1
  7. package/components/DropDownMenuButton/MenuItemRenderer.js +1 -1
  8. package/components/PopupWithArrow/PopupWithArrow.js +9 -1
  9. package/components/ProfileBand/styles.d.ts +1 -1
  10. package/components/ReltioMap/EntityMarker/EntityMarker.d.ts +9 -0
  11. package/components/ReltioMap/EntityMarker/EntityMarker.js +91 -0
  12. package/components/ReltioMap/EntityMarker/styles.d.ts +1 -0
  13. package/components/ReltioMap/EntityMarker/styles.js +13 -0
  14. package/components/ReltioMap/MapControls/MapControlContainer/MapControlContrainer.d.ts +10 -0
  15. package/components/ReltioMap/MapControls/MapControlContainer/MapControlContrainer.js +28 -0
  16. package/components/ReltioMap/MapControls/TopCenterMapControls/TopCenterMapControls.d.ts +7 -0
  17. package/components/ReltioMap/MapControls/TopCenterMapControls/TopCenterMapControls.js +23 -0
  18. package/components/ReltioMap/MapControls/TopCenterMapControls/styles.d.ts +1 -0
  19. package/components/ReltioMap/MapControls/TopCenterMapControls/styles.js +27 -0
  20. package/components/ReltioMap/MapControls/TopRightMapControls/TopRightMapControls.d.ts +47 -0
  21. package/components/ReltioMap/MapControls/TopRightMapControls/TopRightMapControls.js +40 -0
  22. package/components/ReltioMap/MapControls/TopRightMapControls/styles.d.ts +1 -0
  23. package/components/ReltioMap/MapControls/TopRightMapControls/styles.js +22 -0
  24. package/components/ReltioMap/constants.d.ts +14 -0
  25. package/components/ReltioMap/constants.js +17 -0
  26. package/components/ReltioMap/helpers/index.d.ts +6 -0
  27. package/components/ReltioMap/helpers/index.js +63 -0
  28. package/components/ReltioMap/index.d.ts +27 -0
  29. package/components/ReltioMap/index.js +162 -0
  30. package/components/ReltioMap/styles.d.ts +1 -0
  31. package/components/ReltioMap/styles.js +12 -0
  32. package/components/ReltioMap/types.d.ts +23 -0
  33. package/components/ReltioMap/types.js +2 -0
  34. package/components/attributes/PivotingAttributes/PivotingTooltipContent.js +3 -1
  35. package/components/attributes/editMode/AttributesList/AttributesList.js +1 -1
  36. package/components/attributes/editMode/AttributesList/helpers.d.ts +1 -2
  37. package/components/attributes/editMode/AttributesList/helpers.js +1 -20
  38. package/components/attributes/editMode/AttributesPager/AttributeRenderer.js +4 -3
  39. package/components/attributes/editMode/AttributesPager/index.d.ts +4 -2
  40. package/components/attributes/editMode/AttributesPager/index.js +11 -20
  41. package/components/attributes/editMode/ComplexAttribute/ComplexAttribute.d.ts +3 -1
  42. package/components/attributes/editMode/ComplexAttribute/ComplexAttribute.js +19 -5
  43. package/components/attributes/editMode/ComplexAttribute/styles.d.ts +1 -1
  44. package/components/attributes/editMode/ComplexAttribute/styles.js +10 -2
  45. package/components/attributes/editMode/NestedAttribute/NestedAttribute.d.ts +1 -0
  46. package/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
  47. package/components/attributes/editMode/ReferenceAttribute/index.d.ts +1 -0
  48. package/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +15 -4
  49. package/components/attributes/editMode/SimpleAttributeEditor/styles.d.ts +1 -1
  50. package/components/attributes/editMode/SimpleAttributeEditor/styles.js +8 -0
  51. package/components/attributes/inline/ComplexAttribute/ComplexAttribute.js +1 -1
  52. package/components/attributes/readMode/AttributesPager/index.d.ts +3 -1
  53. package/components/attributes/readMode/AttributesPager/index.js +26 -2
  54. package/components/attributes/readMode/NestedAttribute/NestedAttribute.d.ts +1 -0
  55. package/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
  56. package/components/attributes/readMode/ReferenceAttribute/index.d.ts +1 -0
  57. package/components/crosswalks/CrosswalkAttributes/styles.js +3 -2
  58. package/components/crosswalks/CrosswalkEditor/CrosswalkEditor.d.ts +2 -1
  59. package/components/crosswalks/CrosswalkEditor/CrosswalkEditor.js +2 -2
  60. package/components/crosswalks/CrosswalkEditor/styles.d.ts +1 -1
  61. package/components/crosswalks/CrosswalkEditor/styles.js +0 -4
  62. package/components/crosswalks/hooks/useCrosswalkActions.d.ts +12 -0
  63. package/components/crosswalks/hooks/useCrosswalkActions.js +75 -0
  64. package/components/crosswalks/index.d.ts +2 -1
  65. package/components/crosswalks/index.js +3 -1
  66. package/components/crosswalks/types/AddCrosswalkEvent.d.ts +6 -0
  67. package/components/crosswalks/types/AddCrosswalkEvent.js +2 -0
  68. package/components/crosswalks/types/DeleteCrosswalkEvent.d.ts +4 -0
  69. package/components/crosswalks/types/DeleteCrosswalkEvent.js +2 -0
  70. package/components/crosswalks/types/EditCrosswalkEvent.d.ts +6 -0
  71. package/components/crosswalks/types/EditCrosswalkEvent.js +2 -0
  72. package/components/crosswalks/types/index.d.ts +3 -0
  73. package/components/index.d.ts +5 -1
  74. package/components/index.js +10 -3
  75. package/constants/index.d.ts +1 -0
  76. package/constants/index.js +5 -1
  77. package/constants/map.d.ts +14 -0
  78. package/constants/map.js +17 -0
  79. package/contexts/CollaborationContext/index.d.ts +7 -1
  80. package/contexts/CollaborationContext/index.js +4 -2
  81. package/contexts/EntityMarkerContext/index.d.ts +6 -0
  82. package/contexts/EntityMarkerContext/index.js +9 -0
  83. package/contexts/index.d.ts +1 -0
  84. package/contexts/index.js +3 -1
  85. package/hooks/useCollaboration.d.ts +4 -2
  86. package/hooks/useCollaboration.js +56 -7
  87. package/hooks/useRelationsLoader.js +3 -1
  88. package/package.json +3 -3
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.EntityMarkerContext = void 0;
7
+ var react_1 = __importDefault(require("react"));
8
+ exports.EntityMarkerContext = react_1.default.createContext({});
9
+ exports.EntityMarkerContext.displayName = 'EntityMarkerContext';
@@ -9,5 +9,6 @@ export { PivotingAttributeContext } from "./PivotingAttributeContext";
9
9
  export { ProfilePerspectiveViewContext } from "./ProfilePerspectiveViewContext";
10
10
  export { IdContext } from "./IdContext";
11
11
  export { EntitiesMapContext } from "./EntitiesMapContext";
12
+ export { EntityMarkerContext } from "./EntityMarkerContext";
12
13
  export { CrosswalksDisplayProvider, useCrosswalkColor, useCrosswalkFocus, useCrosswalkHighlight, useHighlightedCrosswalks } from "./CrosswalksDisplayContext";
13
14
  export { ExpandedAttributesProvider, useAttributeExpanded } from "./ExpandedAttributesContext";
package/contexts/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useAttributeExpanded = exports.ExpandedAttributesProvider = exports.useHighlightedCrosswalks = exports.useCrosswalkHighlight = exports.useCrosswalkFocus = exports.useCrosswalkColor = exports.CrosswalksDisplayProvider = exports.EntitiesMapContext = exports.IdContext = exports.ProfilePerspectiveViewContext = exports.PivotingAttributeContext = exports.UsersContext = exports.CollaborationContext = exports.BlockImageGalleryDialogContext = exports.ViewIdContext = exports.PopupBoundariesContext = exports.HistoryDiffContext = exports.AsyncMountContext = void 0;
3
+ exports.EntityMarkerContext = exports.useAttributeExpanded = exports.ExpandedAttributesProvider = exports.useHighlightedCrosswalks = exports.useCrosswalkHighlight = exports.useCrosswalkFocus = exports.useCrosswalkColor = exports.CrosswalksDisplayProvider = exports.EntitiesMapContext = exports.IdContext = exports.ProfilePerspectiveViewContext = exports.PivotingAttributeContext = exports.UsersContext = exports.CollaborationContext = exports.BlockImageGalleryDialogContext = exports.ViewIdContext = exports.PopupBoundariesContext = exports.HistoryDiffContext = exports.AsyncMountContext = void 0;
4
4
  var AsyncMountContext_1 = require("./AsyncMountContext");
5
5
  Object.defineProperty(exports, "AsyncMountContext", { enumerable: true, get: function () { return AsyncMountContext_1.AsyncMountContext; } });
6
6
  var HistoryAppearanceContext_1 = require("./HistoryAppearanceContext");
@@ -32,3 +32,5 @@ Object.defineProperty(exports, "useHighlightedCrosswalks", { enumerable: true, g
32
32
  var ExpandedAttributesContext_1 = require("./ExpandedAttributesContext");
33
33
  Object.defineProperty(exports, "ExpandedAttributesProvider", { enumerable: true, get: function () { return ExpandedAttributesContext_1.ExpandedAttributesProvider; } });
34
34
  Object.defineProperty(exports, "useAttributeExpanded", { enumerable: true, get: function () { return ExpandedAttributesContext_1.useAttributeExpanded; } });
35
+ var EntityMarkerContext_1 = require("./EntityMarkerContext");
36
+ Object.defineProperty(exports, "EntityMarkerContext", { enumerable: true, get: function () { return EntityMarkerContext_1.EntityMarkerContext; } });
@@ -3,8 +3,10 @@ export declare const useCollaboration: (objectIds?: string[], objectTypes?: Coll
3
3
  commentsMap: CommentsMap;
4
4
  currentComment: Comment;
5
5
  getComment: (commentId: string) => void;
6
- createReply: ({ content, namedUsers, commentId, action, uri }: any) => void;
7
- createComment: ({ content, namedUsers, objectType, uri, relatedObjectUris }: any) => void;
6
+ createReply: ({ content, namedUsers, commentId, action, uri }: any) => Promise<void>;
7
+ editComment: ({ content, namedUsers, objectType, uri, relatedObjectUris, commentId, replies }: any) => Promise<void>;
8
+ deleteComment: ({ uri, commentId }: any) => void;
9
+ createComment: ({ content, namedUsers, objectType, uri, relatedObjectUris }: any) => Promise<void>;
8
10
  clearCurrentComment: () => void;
9
11
  resolveThread: ({ commentId, uri }: any) => void;
10
12
  reOpenThread: ({ commentId, uri }: any) => void;
@@ -26,6 +26,7 @@ var ramda_1 = require("ramda");
26
26
  var mdm_sdk_1 = require("@reltio/mdm-sdk");
27
27
  var mdm_module_1 = __importDefault(require("@reltio/mdm-module"));
28
28
  var defaultObjectIds = [];
29
+ var catchErrorInRequest = function (e) { return console.error('Collaboration error', e); };
29
30
  var useCollaboration = function (objectIds, objectTypes) {
30
31
  if (objectIds === void 0) { objectIds = defaultObjectIds; }
31
32
  var entity = react_redux_1.useSelector(mdm_module_1.default.selectors.getEntity);
@@ -52,16 +53,35 @@ var useCollaboration = function (objectIds, objectTypes) {
52
53
  setLoading(true);
53
54
  mdm_sdk_1.getComment({ collaborationPath: collaborationPath, tenant: tenant, commentId: commentId })
54
55
  .then(setCurrentComment)
55
- .catch(function (e) { return console.error('Collaboration error', e); })
56
+ .catch(catchErrorInRequest)
56
57
  .finally(function () { return setLoading(false); });
57
58
  }, [collaborationPath, tenant]);
58
- var updateComment = function (comment, uri) {
59
+ var addCommentToState = function (comment, uri) {
59
60
  setCurrentComment(comment);
60
61
  setCommentsMap(function (prevCommentsMap) {
61
62
  var _a;
62
63
  return __assign(__assign({}, prevCommentsMap), (_a = {}, _a[uri] = __spreadArray(__spreadArray([], (prevCommentsMap[uri] || [])), [{ commentId: comment.commentId, replies: 0, status: 'open' }]), _a));
63
64
  });
64
65
  };
66
+ var updateCommentInState = function (comment, uri) {
67
+ setCurrentComment(comment);
68
+ setCommentsMap(function (prevCommentsMap) {
69
+ var _a;
70
+ var comments = (prevCommentsMap[uri] || []).map(function (c) {
71
+ return c.commentId === comment.commentId
72
+ ? __assign(__assign({}, comment), { replies: (typeof comment.replies === 'number' ? comment.replies : comment.replies.length) || 0 }) : c;
73
+ });
74
+ return __assign(__assign({}, prevCommentsMap), (_a = {}, _a[uri] = comments, _a));
75
+ });
76
+ };
77
+ var deleteCommentFromState = function (commentId, uri) {
78
+ setCurrentComment(null);
79
+ setCommentsMap(function (prevCommentsMap) {
80
+ var _a;
81
+ var comments = prevCommentsMap[uri] || [];
82
+ return __assign(__assign({}, prevCommentsMap), (_a = {}, _a[uri] = comments.filter(function (c) { return c.commentId !== commentId; }), _a));
83
+ });
84
+ };
65
85
  var createComment = react_1.useCallback(function (_a) {
66
86
  var content = _a.content, namedUsers = _a.namedUsers, objectType = _a.objectType, uri = _a.uri, relatedObjectUris = _a.relatedObjectUris;
67
87
  setSending(true);
@@ -74,12 +94,39 @@ var useCollaboration = function (objectIds, objectTypes) {
74
94
  namedUsers: namedUsers,
75
95
  permanentLink: ''
76
96
  };
77
- mdm_sdk_1.createComment({ collaborationPath: collaborationPath, tenant: tenant, data: data })
97
+ return mdm_sdk_1.createComment({ collaborationPath: collaborationPath, tenant: tenant, data: data })
78
98
  .then(function (_a) {
79
99
  var comment = _a[0];
80
- return updateComment(comment, uri);
100
+ return addCommentToState(comment, uri);
81
101
  })
82
- .catch(function (e) { return console.error('Collaboration error', e); })
102
+ .catch(catchErrorInRequest)
103
+ .finally(function () { return setSending(false); });
104
+ }, [collaborationPath, tenant]);
105
+ var editComment = react_1.useCallback(function (_a) {
106
+ var content = _a.content, namedUsers = _a.namedUsers, objectType = _a.objectType, uri = _a.uri, relatedObjectUris = _a.relatedObjectUris, commentId = _a.commentId, replies = _a.replies;
107
+ setSending(true);
108
+ var data = {
109
+ objectId: uri,
110
+ content: content,
111
+ relatedObjectUris: relatedObjectUris,
112
+ objectType: objectType,
113
+ visibility: 'public',
114
+ namedUsers: namedUsers,
115
+ permanentLink: '',
116
+ commentId: commentId,
117
+ replies: replies
118
+ };
119
+ return mdm_sdk_1.updateComment({ collaborationPath: collaborationPath, tenant: tenant, data: data })
120
+ .then(function (comment) { return updateCommentInState(__assign(__assign({}, comment), { replies: replies }), uri); })
121
+ .catch(catchErrorInRequest)
122
+ .finally(function () { return setSending(false); });
123
+ }, [collaborationPath, tenant]);
124
+ var deleteComment = react_1.useCallback(function (_a) {
125
+ var uri = _a.uri, commentId = _a.commentId;
126
+ setSending(true);
127
+ mdm_sdk_1.deleteComment({ collaborationPath: collaborationPath, tenant: tenant, commentId: commentId })
128
+ .then(function () { return deleteCommentFromState(commentId, uri); })
129
+ .catch(catchErrorInRequest)
83
130
  .finally(function () { return setSending(false); });
84
131
  }, [collaborationPath, tenant]);
85
132
  var updateReply = react_1.useCallback(function (reply, uri, commentId) {
@@ -116,12 +163,12 @@ var useCollaboration = function (objectIds, objectTypes) {
116
163
  action: action,
117
164
  namedUsers: namedUsers
118
165
  };
119
- mdm_sdk_1.createReply({ collaborationPath: collaborationPath, tenant: tenant, commentId: commentId, data: data })
166
+ return mdm_sdk_1.createReply({ collaborationPath: collaborationPath, tenant: tenant, commentId: commentId, data: data })
120
167
  .then(function (_a) {
121
168
  var reply = _a[0];
122
169
  return updateReply(reply, uri, commentId);
123
170
  })
124
- .catch(function (e) { return console.error('Collaboration error', e); })
171
+ .catch(catchErrorInRequest)
125
172
  .finally(function () { return setSending(false); });
126
173
  }, [collaborationPath, tenant, updateReply]);
127
174
  var resolveThread = react_1.useCallback(function (_a) {
@@ -140,6 +187,8 @@ var useCollaboration = function (objectIds, objectTypes) {
140
187
  currentComment: currentComment,
141
188
  getComment: getComment,
142
189
  createReply: createReply,
190
+ editComment: editComment,
191
+ deleteComment: deleteComment,
143
192
  createComment: createComment,
144
193
  clearCurrentComment: clearCurrentComment,
145
194
  resolveThread: resolveThread,
@@ -78,12 +78,14 @@ var useRelationsLoader = function (_a) {
78
78
  setIsLoading(false);
79
79
  });
80
80
  }
81
+ // eslint-disable-next-line react-hooks/exhaustive-deps
81
82
  }, [
82
83
  activityFilter,
83
84
  config,
84
85
  dispatch,
85
86
  dtssPath,
86
- entity,
87
+ entity === null || entity === void 0 ? void 0 : entity.uri,
88
+ entity === null || entity === void 0 ? void 0 : entity.dataTenant,
87
89
  filter,
88
90
  globalFilter,
89
91
  page,
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.807",
3
+ "version": "1.4.811",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "index.js",
6
6
  "dependencies": {
7
7
  "@date-io/moment": "^1.3.5",
8
- "@reltio/mdm-module": "^1.4.807",
9
- "@reltio/mdm-sdk": "^1.4.807",
8
+ "@reltio/mdm-module": "^1.4.811",
9
+ "@reltio/mdm-sdk": "^1.4.811",
10
10
  "classnames": "^2.2.5",
11
11
  "frontend-collective-react-dnd-scrollzone": "^1.0.2",
12
12
  "nanoid": "^2.0.0",