@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.
- package/BarChart/helpers.js +3 -0
- package/ChartLegend/styles.js +2 -1
- package/ChartTooltip/styles.js +2 -1
- package/CollaborationItem/components/CommentTarget/styles.js +2 -1
- package/ComplexAttributeLabel/styles.js +2 -1
- package/DefaultCellValueRenderer/styles.js +1 -1
- package/EditModeComplexAttribute/styles.js +2 -1
- package/EntitySelector/components/EntityOption/styles.js +1 -1
- package/HOCs/withFilter/components/FilterChip/styles.js +1 -1
- package/HOCs/withReactSelectMuiSkin/styles.js +2 -1
- package/HierarchyNodeTitle/styles.js +1 -1
- package/InlineSimpleAttribute/styles.js +2 -1
- package/PivotingTooltip/components/PivotingTooltipContent/styles.js +2 -1
- package/PivotingTooltip/styles.js +2 -1
- package/ProfileBand/styles.js +4 -1
- package/ProfileCard/components/ProfileCardContent/styles.js +2 -2
- package/ProfilesList/styles.js +6 -3
- package/ReadOnlyComplexAttribute/styles.js +2 -1
- package/ScreenProfileBand/ScreenProfileBand.test.js +1 -1
- package/SimpleAttribute/styles.js +2 -1
- package/TableWithBars/components/AttributeCellRenderer/styles.js +1 -1
- package/TypeaheadEditor/styles.js +2 -1
- package/ValueChip/styles.js +1 -1
- package/cjs/BarChart/helpers.js +3 -0
- package/cjs/ChartLegend/styles.js +2 -1
- package/cjs/ChartTooltip/styles.js +2 -1
- package/cjs/CollaborationItem/components/CommentTarget/styles.js +2 -1
- package/cjs/ComplexAttributeLabel/styles.js +2 -1
- package/cjs/DefaultCellValueRenderer/styles.js +1 -1
- package/cjs/EditModeComplexAttribute/styles.js +2 -1
- package/cjs/EntitySelector/components/EntityOption/styles.js +1 -1
- package/cjs/HOCs/withFilter/components/FilterChip/styles.js +1 -1
- package/cjs/HOCs/withReactSelectMuiSkin/styles.js +2 -1
- package/cjs/HierarchyNodeTitle/styles.js +1 -1
- package/cjs/InlineSimpleAttribute/styles.js +2 -1
- package/cjs/PivotingTooltip/components/PivotingTooltipContent/styles.js +2 -1
- package/cjs/PivotingTooltip/styles.js +2 -1
- package/cjs/ProfileBand/styles.js +4 -1
- package/cjs/ProfileCard/components/ProfileCardContent/styles.js +2 -2
- package/cjs/ProfilesList/styles.js +6 -3
- package/cjs/ReadOnlyComplexAttribute/styles.js +2 -1
- package/cjs/ScreenProfileBand/ScreenProfileBand.test.js +1 -1
- package/cjs/SimpleAttribute/styles.js +2 -1
- package/cjs/TableWithBars/components/AttributeCellRenderer/styles.js +1 -1
- package/cjs/TypeaheadEditor/styles.js +2 -1
- package/cjs/ValueChip/styles.js +1 -1
- package/cjs/constants/theme.d.ts +5 -0
- package/cjs/constants/theme.js +5 -0
- package/cjs/features/activity-log/ActivitiesFactory/components/SimpleActivity/styles.js +2 -1
- package/cjs/features/activity-log/EntityObject/styles.js +1 -0
- package/cjs/features/activity-log/Field/styles.js +2 -1
- package/cjs/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/styles.js +2 -1
- package/cjs/features/activity-log/RelationObject/styles.js +2 -1
- package/cjs/features/workflow/AttributesChanges/components/DiffRenderer/styles.js +2 -1
- package/cjs/features/workflow/AttributesChanges/styles.js +2 -1
- package/cjs/hooks/useCollaboration/useCollaboration.d.ts +2 -1
- package/cjs/hooks/useCollaboration/useCollaboration.js +24 -18
- package/cjs/hooks/useCollaboration/useCollaboration.test.js +112 -171
- package/constants/theme.d.ts +5 -0
- package/constants/theme.js +5 -0
- package/features/activity-log/ActivitiesFactory/components/SimpleActivity/styles.js +2 -1
- package/features/activity-log/EntityObject/styles.js +1 -0
- package/features/activity-log/Field/styles.js +2 -1
- package/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/styles.js +2 -1
- package/features/activity-log/RelationObject/styles.js +2 -1
- package/features/workflow/AttributesChanges/components/DiffRenderer/styles.js +2 -1
- package/features/workflow/AttributesChanges/styles.js +2 -1
- package/hooks/useCollaboration/useCollaboration.d.ts +2 -1
- package/hooks/useCollaboration/useCollaboration.js +24 -18
- package/hooks/useCollaboration/useCollaboration.test.js +112 -171
- package/package.json +2 -2
package/constants/theme.d.ts
CHANGED
package/constants/theme.js
CHANGED
|
@@ -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,
|
|
@@ -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',
|
|
@@ -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
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
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
|
|
59
|
-
|
|
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
|
|
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
|
-
|
|
88
|
-
|
|
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;
|