@reltio/components 1.4.2155 → 1.4.2157

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 (71) hide show
  1. package/BarChart/helpers.js +3 -0
  2. package/ChartLegend/styles.js +2 -1
  3. package/ChartTooltip/styles.js +2 -1
  4. package/CollaborationItem/components/CommentTarget/styles.js +2 -1
  5. package/ComplexAttributeLabel/styles.js +2 -1
  6. package/DefaultCellValueRenderer/styles.js +1 -1
  7. package/EditModeComplexAttribute/styles.js +2 -1
  8. package/EntitySelector/components/EntityOption/styles.js +1 -1
  9. package/HOCs/withFilter/components/FilterChip/styles.js +1 -1
  10. package/HOCs/withReactSelectMuiSkin/styles.js +2 -1
  11. package/HierarchyNodeTitle/styles.js +1 -1
  12. package/InlineSimpleAttribute/styles.js +2 -1
  13. package/PivotingTooltip/components/PivotingTooltipContent/styles.js +2 -1
  14. package/PivotingTooltip/styles.js +2 -1
  15. package/ProfileBand/styles.js +4 -1
  16. package/ProfileCard/components/ProfileCardContent/styles.js +2 -2
  17. package/ProfilesList/styles.js +6 -3
  18. package/ReadOnlyComplexAttribute/styles.js +2 -1
  19. package/ScreenProfileBand/ScreenProfileBand.test.js +1 -1
  20. package/SimpleAttribute/styles.js +2 -1
  21. package/TableWithBars/components/AttributeCellRenderer/styles.js +1 -1
  22. package/TypeaheadEditor/styles.js +2 -1
  23. package/ValueChip/styles.js +1 -1
  24. package/cjs/BarChart/helpers.js +3 -0
  25. package/cjs/ChartLegend/styles.js +2 -1
  26. package/cjs/ChartTooltip/styles.js +2 -1
  27. package/cjs/CollaborationItem/components/CommentTarget/styles.js +2 -1
  28. package/cjs/ComplexAttributeLabel/styles.js +2 -1
  29. package/cjs/DefaultCellValueRenderer/styles.js +1 -1
  30. package/cjs/EditModeComplexAttribute/styles.js +2 -1
  31. package/cjs/EntitySelector/components/EntityOption/styles.js +1 -1
  32. package/cjs/HOCs/withFilter/components/FilterChip/styles.js +1 -1
  33. package/cjs/HOCs/withReactSelectMuiSkin/styles.js +2 -1
  34. package/cjs/HierarchyNodeTitle/styles.js +1 -1
  35. package/cjs/InlineSimpleAttribute/styles.js +2 -1
  36. package/cjs/PivotingTooltip/components/PivotingTooltipContent/styles.js +2 -1
  37. package/cjs/PivotingTooltip/styles.js +2 -1
  38. package/cjs/ProfileBand/styles.js +4 -1
  39. package/cjs/ProfileCard/components/ProfileCardContent/styles.js +2 -2
  40. package/cjs/ProfilesList/styles.js +6 -3
  41. package/cjs/ReadOnlyComplexAttribute/styles.js +2 -1
  42. package/cjs/ScreenProfileBand/ScreenProfileBand.test.js +1 -1
  43. package/cjs/SimpleAttribute/styles.js +2 -1
  44. package/cjs/TableWithBars/components/AttributeCellRenderer/styles.js +1 -1
  45. package/cjs/TypeaheadEditor/styles.js +2 -1
  46. package/cjs/ValueChip/styles.js +1 -1
  47. package/cjs/constants/theme.d.ts +5 -0
  48. package/cjs/constants/theme.js +5 -0
  49. package/cjs/features/activity-log/ActivitiesFactory/components/SimpleActivity/styles.js +2 -1
  50. package/cjs/features/activity-log/EntityObject/styles.js +1 -0
  51. package/cjs/features/activity-log/Field/styles.js +2 -1
  52. package/cjs/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/styles.js +2 -1
  53. package/cjs/features/activity-log/RelationObject/styles.js +2 -1
  54. package/cjs/features/workflow/AttributesChanges/components/DiffRenderer/styles.js +2 -1
  55. package/cjs/features/workflow/AttributesChanges/styles.js +2 -1
  56. package/cjs/hooks/useCollaboration/useCollaboration.d.ts +2 -1
  57. package/cjs/hooks/useCollaboration/useCollaboration.js +24 -18
  58. package/cjs/hooks/useCollaboration/useCollaboration.test.js +112 -171
  59. package/constants/theme.d.ts +5 -0
  60. package/constants/theme.js +5 -0
  61. package/features/activity-log/ActivitiesFactory/components/SimpleActivity/styles.js +2 -1
  62. package/features/activity-log/EntityObject/styles.js +1 -0
  63. package/features/activity-log/Field/styles.js +2 -1
  64. package/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/styles.js +2 -1
  65. package/features/activity-log/RelationObject/styles.js +2 -1
  66. package/features/workflow/AttributesChanges/components/DiffRenderer/styles.js +2 -1
  67. package/features/workflow/AttributesChanges/styles.js +2 -1
  68. package/hooks/useCollaboration/useCollaboration.d.ts +2 -1
  69. package/hooks/useCollaboration/useCollaboration.js +24 -18
  70. package/hooks/useCollaboration/useCollaboration.test.js +112 -171
  71. package/package.json +2 -2
@@ -60,6 +60,11 @@ export declare const theme: {
60
60
  defaultProps: {
61
61
  disableInteractive: boolean;
62
62
  };
63
+ styleOverrides: {
64
+ tooltip: {
65
+ whiteSpace: "break-spaces";
66
+ };
67
+ };
63
68
  };
64
69
  MuiTab: {
65
70
  styleOverrides: {
@@ -34,6 +34,11 @@ export var theme = {
34
34
  MuiTooltip: {
35
35
  defaultProps: {
36
36
  disableInteractive: true
37
+ },
38
+ styleOverrides: {
39
+ tooltip: {
40
+ whiteSpace: 'break-spaces'
41
+ }
37
42
  }
38
43
  },
39
44
  MuiTab: {
@@ -4,6 +4,7 @@ export var useStyles = makeStyles(function (theme) { return ({
4
4
  color: theme.palette.primary.main,
5
5
  textDecoration: 'none',
6
6
  fontWeight: 400,
7
- cursor: 'pointer'
7
+ cursor: 'pointer',
8
+ whiteSpace: 'break-spaces'
8
9
  }
9
10
  }); });
@@ -6,6 +6,7 @@ export var useStyles = makeStyles(function (theme) { return ({
6
6
  color: theme.palette.primary.main,
7
7
  textDecoration: 'none',
8
8
  fontWeight: 400,
9
+ whiteSpace: 'break-spaces',
9
10
  '&.removed': {
10
11
  pointerEvents: 'none',
11
12
  color: theme.palette.text.secondary
@@ -5,7 +5,8 @@ export var useStyles = makeStyles(function (theme) { return ({
5
5
  lineHeight: '20px',
6
6
  color: theme.palette.text.primary,
7
7
  marginTop: 4,
8
- display: 'block'
8
+ display: 'block',
9
+ whiteSpace: 'break-spaces'
9
10
  },
10
11
  fieldName: {
11
12
  color: theme.palette.text.secondary,
@@ -10,6 +10,7 @@ export var useStyles = makeStyles(function (theme) { return ({
10
10
  color: theme.palette.primary.main,
11
11
  textDecoration: 'none',
12
12
  fontWeight: 400,
13
- cursor: 'pointer'
13
+ cursor: 'pointer',
14
+ whiteSpace: 'break-spaces'
14
15
  }
15
16
  }); });
@@ -9,7 +9,8 @@ export var useStyles = makeStyles(function (theme) { return ({
9
9
  link: {
10
10
  color: theme.palette.primary.main,
11
11
  textDecoration: 'none',
12
- fontWeight: 400
12
+ fontWeight: 400,
13
+ whiteSpace: 'break-spaces'
13
14
  },
14
15
  delimiter: {
15
16
  margin: '0 8px'
@@ -9,7 +9,8 @@ export var useStyles = makeStyles(function (theme) { return ({
9
9
  color: theme.palette.primary.main,
10
10
  fontSize: '12px',
11
11
  letterSpacing: 0,
12
- lineHeight: '16px'
12
+ lineHeight: '16px',
13
+ whiteSpace: 'break-spaces'
13
14
  },
14
15
  disabledLink: {
15
16
  pointerEvents: 'none',
@@ -16,7 +16,8 @@ export var useStyles = makeStyles(function (theme) { return ({
16
16
  label: {
17
17
  fontSize: '12px',
18
18
  letterSpacing: 0,
19
- lineHeight: '16px'
19
+ lineHeight: '16px',
20
+ whiteSpace: 'break-spaces'
20
21
  },
21
22
  showMoreLink: {
22
23
  marginTop: '8px'
@@ -3,8 +3,9 @@ type Props = {
3
3
  objectIds?: string[];
4
4
  objectTypes?: CollaborationObjectTypes[];
5
5
  enabled?: boolean;
6
+ needsTotalCount?: boolean;
6
7
  };
7
- export declare const useCollaboration: ({ objectIds, objectTypes, enabled }: Props) => {
8
+ export declare const useCollaboration: ({ objectIds, objectTypes, enabled, needsTotalCount }: Props) => {
8
9
  clearCurrentComment: () => void;
9
10
  comments: Comment[];
10
11
  commentsMap: CommentsMap;
@@ -35,19 +35,19 @@ var getUpdatedReplies = function (comment, reply) {
35
35
  var defaultObjectIds = [];
36
36
  var catchErrorInRequest = function (e) { return console.warn('Collaboration error', e); };
37
37
  export var useCollaboration = function (_a) {
38
- var _b = _a.objectIds, objectIds = _b === void 0 ? defaultObjectIds : _b, objectTypes = _a.objectTypes, _c = _a.enabled, enabled = _c === void 0 ? true : _c;
38
+ var _b = _a.objectIds, objectIds = _b === void 0 ? defaultObjectIds : _b, objectTypes = _a.objectTypes, _c = _a.enabled, enabled = _c === void 0 ? true : _c, _d = _a.needsTotalCount, needsTotalCount = _d === void 0 ? false : _d;
39
39
  var entity = useMdmEntity();
40
40
  var tenant = useMdmTenant();
41
41
  var collaborationPath = useMdmCollaborationPath();
42
42
  var isCollaborationEnabled = useMdmIsCollaborationEnabled() && enabled;
43
- var _d = useState(null), pageToken = _d[0], setPageToken = _d[1];
44
- var _e = useState([]), comments = _e[0], setComments = _e[1];
45
- var _f = useState(null), commentsMap = _f[0], setCommentsMap = _f[1];
46
- var _g = useState(null), totalCommentsCount = _g[0], setTotalCommentsCount = _g[1];
47
- var _h = useState(null), currentComment = _h[0], setCurrentComment = _h[1];
48
- var _j = useState(false), sending = _j[0], setSending = _j[1];
49
- var _k = useState(false), loading = _k[0], setLoading = _k[1];
50
- var _l = useState({}), collaborationStateMap = _l[0], setCollaborationStateMap = _l[1];
43
+ var _e = useState(null), pageToken = _e[0], setPageToken = _e[1];
44
+ var _f = useState([]), comments = _f[0], setComments = _f[1];
45
+ var _g = useState(null), commentsMap = _g[0], setCommentsMap = _g[1];
46
+ var _h = useState(null), totalCommentsCount = _h[0], setTotalCommentsCount = _h[1];
47
+ var _j = useState(null), currentComment = _j[0], setCurrentComment = _j[1];
48
+ var _k = useState(false), sending = _k[0], setSending = _k[1];
49
+ var _l = useState(false), loading = _l[0], setLoading = _l[1];
50
+ var _m = useState({}), collaborationStateMap = _m[0], setCollaborationStateMap = _m[1];
51
51
  var addCommentsToCommentsMap = useCallback(function (commentsMap) {
52
52
  setCommentsMap(function (currentCommentsMap) { return (__assign(__assign({}, currentCommentsMap), commentsMap)); });
53
53
  }, []);
@@ -55,18 +55,16 @@ export var useCollaboration = function (_a) {
55
55
  var isCollaborationEnabledForEntity = isCollaborationEnabled && entityUri && !isTempUri(entityUri);
56
56
  var getCommentsCount = useCallback(function (objectIds, shouldResetCommentsMap) {
57
57
  if (shouldResetCommentsMap === void 0) { shouldResetCommentsMap = false; }
58
- if (!isCollaborationEnabledForEntity || totalCommentsCount == null) {
59
- return setCommentsMap(null);
60
- }
61
- if (totalCommentsCount === 0) {
62
- return shouldResetCommentsMap && setCommentsMap({});
58
+ if (!isCollaborationEnabledForEntity) {
59
+ setCommentsMap(null);
60
+ return;
63
61
  }
64
62
  var onError = function (e) {
65
63
  console.warn('Collaboration error', e);
66
64
  setCommentsMap(null);
67
65
  };
68
66
  pipe(getCommentsCountRequest, andThen(map(props(['objectId', 'comments']))), andThen(fromPairs), andThen(shouldResetCommentsMap ? setCommentsMap : addCommentsToCommentsMap), otherwise(onError))({ uris: objectIds, tenant: tenant, collaborationPath: collaborationPath });
69
- }, [addCommentsToCommentsMap, collaborationPath, isCollaborationEnabledForEntity, tenant, totalCommentsCount]);
67
+ }, [addCommentsToCommentsMap, collaborationPath, isCollaborationEnabledForEntity, tenant]);
70
68
  var getTotalCommentsCount = useCallback(function () {
71
69
  if (isCollaborationEnabledForEntity) {
72
70
  var onError = function (e) {
@@ -84,8 +82,10 @@ export var useCollaboration = function (_a) {
84
82
  }
85
83
  }, [isCollaborationEnabledForEntity, collaborationPath, entityUri, tenant]);
86
84
  useEffect(function () {
87
- getTotalCommentsCount();
88
- }, [getTotalCommentsCount]);
85
+ if (needsTotalCount) {
86
+ getTotalCommentsCount();
87
+ }
88
+ }, [getTotalCommentsCount, needsTotalCount]);
89
89
  useEffect(function () {
90
90
  getCommentsCount(objectIds, true);
91
91
  }, [objectIds, getCommentsCount]);
@@ -124,16 +124,22 @@ export var useCollaboration = function (_a) {
124
124
  setComments(map(when(propEq('commentId', comment.commentId), always(comment))));
125
125
  };
126
126
  var deleteCommentFromState = function (commentId, uri) {
127
+ var repliesCountFromComments;
128
+ var repliesCountFromCommentsMap;
127
129
  setCurrentComment(null);
128
130
  setCommentsMap(function (prevCommentsMap) {
129
131
  var _a;
132
+ var _b, _c;
133
+ repliesCountFromCommentsMap = (_c = (_b = prevCommentsMap === null || prevCommentsMap === void 0 ? void 0 : prevCommentsMap[uri]) === null || _b === void 0 ? void 0 : _b.find(function (c) { return c.commentId === commentId; })) === null || _c === void 0 ? void 0 : _c.replies;
130
134
  var comments = prevCommentsMap[uri] || [];
131
135
  return __assign(__assign({}, prevCommentsMap), (_a = {}, _a[uri] = comments.filter(function (c) { return c.commentId !== commentId; }), _a));
132
136
  });
133
137
  setComments(function (prevComments) {
138
+ var _a;
139
+ repliesCountFromComments = (_a = prevComments.find(function (comment) { return comment.commentId === commentId; })) === null || _a === void 0 ? void 0 : _a.replies.length;
134
140
  return prevComments.filter(function (comment) { return comment.commentId !== commentId; });
135
141
  });
136
- setTotalCommentsCount(function (prevCount) { return Math.max((prevCount || 0) - 1, 0); });
142
+ setTotalCommentsCount(function (prevCount) { var _a; return Math.max((prevCount || 0) - (1 + ((_a = repliesCountFromComments !== null && repliesCountFromComments !== void 0 ? repliesCountFromComments : repliesCountFromCommentsMap) !== null && _a !== void 0 ? _a : 0)), 0); });
137
143
  };
138
144
  var createComment = useCallback(function (_a) {
139
145
  var content = _a.content, namedUsers = _a.namedUsers, objectType = _a.objectType, uri = _a.uri, relatedObjectUris = _a.relatedObjectUris;