@reltio/components 1.4.1636 → 1.4.1637
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/cjs/components/CollaborationItem/Comment/Comment.js +2 -7
- package/cjs/components/CollaborationItem/RepliedComment/RepliedComment.js +2 -5
- package/cjs/hooks/index.d.ts +1 -0
- package/cjs/hooks/index.js +3 -1
- package/cjs/hooks/useAutoFocus.d.ts +2 -0
- package/cjs/hooks/useAutoFocus.js +15 -0
- package/esm/components/CollaborationItem/Comment/Comment.js +3 -8
- package/esm/components/CollaborationItem/RepliedComment/RepliedComment.js +3 -6
- package/esm/hooks/index.d.ts +1 -0
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/useAutoFocus.d.ts +2 -0
- package/esm/hooks/useAutoFocus.js +11 -0
- package/package.json +3 -3
|
@@ -41,6 +41,7 @@ var CommentTarget_1 = require("../CommentTarget/CommentTarget");
|
|
|
41
41
|
var CommentContent_1 = require("../CommentContent/CommentContent");
|
|
42
42
|
var Avatar_1 = require("../Avatar/Avatar");
|
|
43
43
|
var contexts_1 = require("../../../contexts");
|
|
44
|
+
var hooks_1 = require("../../../hooks");
|
|
44
45
|
var utils_1 = require("../utils");
|
|
45
46
|
var SendMessageArea_1 = require("../SendMessageArea/SendMessageArea");
|
|
46
47
|
var styles_1 = require("./styles");
|
|
@@ -56,13 +57,7 @@ var Comment = function (_a) {
|
|
|
56
57
|
var commentUri = (0, utils_1.createEditedCommentUri)(comment);
|
|
57
58
|
var isEditing = getCommentState(uri, commentUri).isEditing;
|
|
58
59
|
var updateIsEditingComment = (0, react_1.useCallback)(function (value) { return updateCommentState(uri, commentUri, { isEditing: value }); }, [commentUri, updateCommentState, uri]);
|
|
59
|
-
(0,
|
|
60
|
-
if (isEditing) {
|
|
61
|
-
var position = inputRef.current.value.length;
|
|
62
|
-
inputRef.current.focus();
|
|
63
|
-
inputRef.current.setSelectionRange(position, position);
|
|
64
|
-
}
|
|
65
|
-
}, [isEditing]);
|
|
60
|
+
(0, hooks_1.useAutoFocus)(inputRef, isEditing);
|
|
66
61
|
var menuItems = (0, react_1.useMemo)(function () {
|
|
67
62
|
return isResolved
|
|
68
63
|
? [
|
|
@@ -39,6 +39,7 @@ var Avatar_1 = require("../Avatar/Avatar");
|
|
|
39
39
|
var CommentContent_1 = require("../CommentContent/CommentContent");
|
|
40
40
|
var utils_1 = require("../utils");
|
|
41
41
|
var contexts_1 = require("../../../contexts");
|
|
42
|
+
var hooks_1 = require("../../../hooks");
|
|
42
43
|
var DropDownMenuButton_1 = __importDefault(require("../../DropDownMenuButton/DropDownMenuButton"));
|
|
43
44
|
var SmallIconButton_1 = require("../../SmallIconButton");
|
|
44
45
|
var SendMessageArea_1 = require("../SendMessageArea/SendMessageArea");
|
|
@@ -53,11 +54,7 @@ var RepliedComment = function (_a) {
|
|
|
53
54
|
var commentUri = (0, utils_1.createEditedReplyUri)(comment, reply);
|
|
54
55
|
var isEditing = getCommentState(uri, commentUri).isEditing;
|
|
55
56
|
var updateIsEditingReply = (0, react_1.useCallback)(function (value) { return updateCommentState(uri, commentUri, { isEditing: value }); }, [commentUri, updateCommentState, uri]);
|
|
56
|
-
(0,
|
|
57
|
-
if (isEditing) {
|
|
58
|
-
inputRef.current.focus();
|
|
59
|
-
}
|
|
60
|
-
}, [isEditing]);
|
|
57
|
+
(0, hooks_1.useAutoFocus)(inputRef, isEditing);
|
|
61
58
|
var styles = (0, styles_1.useStyles)();
|
|
62
59
|
var menuItems = (0, react_1.useMemo)(function () { return [
|
|
63
60
|
{
|
package/cjs/hooks/index.d.ts
CHANGED
|
@@ -25,3 +25,4 @@ export { useSavedStateForEntityType } from './useSavedStateForEntityType';
|
|
|
25
25
|
export { useSnackbar } from './useSnackbar';
|
|
26
26
|
export { useIsMountedRef } from './useIsMountedRef';
|
|
27
27
|
export { useLayoutResetter } from './useLayoutResetter';
|
|
28
|
+
export { useAutoFocus } from './useAutoFocus';
|
package/cjs/hooks/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useLayoutResetter = exports.useIsMountedRef = exports.useSnackbar = exports.useSavedStateForEntityType = exports.useReadableSearchState = exports.useEditableConnection = exports.useCustomScripts = exports.useMarkAsNotMatchRequest = exports.useMergeAllRequest = exports.usePagingSimulator = exports.useMatchesLoader = exports.useConfigPermissions = exports.useWhyDidYouUpdate = exports.useUsers = exports.useSavedState = exports.useSafePromise = exports.useRunOnceAfterValueInitialization = exports.useRelationsLoader = exports.useRelationTypeSelector = exports.usePrevious = exports.useDidUpdateEffect = exports.useCommentsEntitiesMap = exports.useCollaboration = exports.useAsyncMount = exports.useAPI = exports.useActions = exports.useScrollToAttributeError = void 0;
|
|
3
|
+
exports.useAutoFocus = exports.useLayoutResetter = exports.useIsMountedRef = exports.useSnackbar = exports.useSavedStateForEntityType = exports.useReadableSearchState = exports.useEditableConnection = exports.useCustomScripts = exports.useMarkAsNotMatchRequest = exports.useMergeAllRequest = exports.usePagingSimulator = exports.useMatchesLoader = exports.useConfigPermissions = exports.useWhyDidYouUpdate = exports.useUsers = exports.useSavedState = exports.useSafePromise = exports.useRunOnceAfterValueInitialization = exports.useRelationsLoader = exports.useRelationTypeSelector = exports.usePrevious = exports.useDidUpdateEffect = exports.useCommentsEntitiesMap = exports.useCollaboration = exports.useAsyncMount = exports.useAPI = exports.useActions = exports.useScrollToAttributeError = void 0;
|
|
4
4
|
var useScrollToAttributeError_1 = require("./useScrollToAttributeError/useScrollToAttributeError");
|
|
5
5
|
Object.defineProperty(exports, "useScrollToAttributeError", { enumerable: true, get: function () { return useScrollToAttributeError_1.useScrollToAttributeError; } });
|
|
6
6
|
var useActions_1 = require("./useActions");
|
|
@@ -55,3 +55,5 @@ var useIsMountedRef_1 = require("./useIsMountedRef");
|
|
|
55
55
|
Object.defineProperty(exports, "useIsMountedRef", { enumerable: true, get: function () { return useIsMountedRef_1.useIsMountedRef; } });
|
|
56
56
|
var useLayoutResetter_1 = require("./useLayoutResetter");
|
|
57
57
|
Object.defineProperty(exports, "useLayoutResetter", { enumerable: true, get: function () { return useLayoutResetter_1.useLayoutResetter; } });
|
|
58
|
+
var useAutoFocus_1 = require("./useAutoFocus");
|
|
59
|
+
Object.defineProperty(exports, "useAutoFocus", { enumerable: true, get: function () { return useAutoFocus_1.useAutoFocus; } });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAutoFocus = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var useAutoFocus = function (inputRef, isEditing) {
|
|
6
|
+
(0, react_1.useEffect)(function () {
|
|
7
|
+
var _a, _b, _c, _d;
|
|
8
|
+
if (isEditing) {
|
|
9
|
+
var position = (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.length;
|
|
10
|
+
(_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.focus();
|
|
11
|
+
(_d = inputRef.current) === null || _d === void 0 ? void 0 : _d.setSelectionRange(position, position);
|
|
12
|
+
}
|
|
13
|
+
}, [inputRef, isEditing]);
|
|
14
|
+
};
|
|
15
|
+
exports.useAutoFocus = useAutoFocus;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo, useContext, useRef,
|
|
1
|
+
import React, { useMemo, useContext, useRef, useCallback } from 'react';
|
|
2
2
|
import { useSelector } from 'react-redux';
|
|
3
3
|
import i18n from 'ui-i18n';
|
|
4
4
|
import Link from '@mui/material/Link';
|
|
@@ -12,6 +12,7 @@ import { CommentTarget } from '../CommentTarget/CommentTarget';
|
|
|
12
12
|
import { CommentContent } from '../CommentContent/CommentContent';
|
|
13
13
|
import { Avatar } from '../Avatar/Avatar';
|
|
14
14
|
import { CollaborationContext } from '../../../contexts';
|
|
15
|
+
import { useAutoFocus } from '../../../hooks';
|
|
15
16
|
import { createEditedCommentUri, formatDate } from '../utils';
|
|
16
17
|
import { SendMessageArea } from '../SendMessageArea/SendMessageArea';
|
|
17
18
|
import { useStyles } from './styles';
|
|
@@ -27,13 +28,7 @@ export var Comment = function (_a) {
|
|
|
27
28
|
var commentUri = createEditedCommentUri(comment);
|
|
28
29
|
var isEditing = getCommentState(uri, commentUri).isEditing;
|
|
29
30
|
var updateIsEditingComment = useCallback(function (value) { return updateCommentState(uri, commentUri, { isEditing: value }); }, [commentUri, updateCommentState, uri]);
|
|
30
|
-
|
|
31
|
-
if (isEditing) {
|
|
32
|
-
var position = inputRef.current.value.length;
|
|
33
|
-
inputRef.current.focus();
|
|
34
|
-
inputRef.current.setSelectionRange(position, position);
|
|
35
|
-
}
|
|
36
|
-
}, [isEditing]);
|
|
31
|
+
useAutoFocus(inputRef, isEditing);
|
|
37
32
|
var menuItems = useMemo(function () {
|
|
38
33
|
return isResolved
|
|
39
34
|
? [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef, useContext, useMemo,
|
|
1
|
+
import React, { useRef, useContext, useMemo, useCallback } from 'react';
|
|
2
2
|
import { useSelector } from 'react-redux';
|
|
3
3
|
import i18n from 'ui-i18n';
|
|
4
4
|
import classnames from 'classnames';
|
|
@@ -10,6 +10,7 @@ import { Avatar } from '../Avatar/Avatar';
|
|
|
10
10
|
import { CommentContent } from '../CommentContent/CommentContent';
|
|
11
11
|
import { createEditedReplyUri, formatDate } from '../utils';
|
|
12
12
|
import { CollaborationContext } from '../../../contexts';
|
|
13
|
+
import { useAutoFocus } from '../../../hooks';
|
|
13
14
|
import DropDownMenuButton from '../../DropDownMenuButton/DropDownMenuButton';
|
|
14
15
|
import { SmallIconButtonWithTooltip } from '../../SmallIconButton';
|
|
15
16
|
import { SendMessageArea } from '../SendMessageArea/SendMessageArea';
|
|
@@ -24,11 +25,7 @@ export var RepliedComment = function (_a) {
|
|
|
24
25
|
var commentUri = createEditedReplyUri(comment, reply);
|
|
25
26
|
var isEditing = getCommentState(uri, commentUri).isEditing;
|
|
26
27
|
var updateIsEditingReply = useCallback(function (value) { return updateCommentState(uri, commentUri, { isEditing: value }); }, [commentUri, updateCommentState, uri]);
|
|
27
|
-
|
|
28
|
-
if (isEditing) {
|
|
29
|
-
inputRef.current.focus();
|
|
30
|
-
}
|
|
31
|
-
}, [isEditing]);
|
|
28
|
+
useAutoFocus(inputRef, isEditing);
|
|
32
29
|
var styles = useStyles();
|
|
33
30
|
var menuItems = useMemo(function () { return [
|
|
34
31
|
{
|
package/esm/hooks/index.d.ts
CHANGED
|
@@ -25,3 +25,4 @@ export { useSavedStateForEntityType } from './useSavedStateForEntityType';
|
|
|
25
25
|
export { useSnackbar } from './useSnackbar';
|
|
26
26
|
export { useIsMountedRef } from './useIsMountedRef';
|
|
27
27
|
export { useLayoutResetter } from './useLayoutResetter';
|
|
28
|
+
export { useAutoFocus } from './useAutoFocus';
|
package/esm/hooks/index.js
CHANGED
|
@@ -25,3 +25,4 @@ export { useSavedStateForEntityType } from './useSavedStateForEntityType';
|
|
|
25
25
|
export { useSnackbar } from './useSnackbar';
|
|
26
26
|
export { useIsMountedRef } from './useIsMountedRef';
|
|
27
27
|
export { useLayoutResetter } from './useLayoutResetter';
|
|
28
|
+
export { useAutoFocus } from './useAutoFocus';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export var useAutoFocus = function (inputRef, isEditing) {
|
|
3
|
+
useEffect(function () {
|
|
4
|
+
var _a, _b, _c, _d;
|
|
5
|
+
if (isEditing) {
|
|
6
|
+
var position = (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.length;
|
|
7
|
+
(_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.focus();
|
|
8
|
+
(_d = inputRef.current) === null || _d === void 0 ? void 0 : _d.setSelectionRange(position, position);
|
|
9
|
+
}
|
|
10
|
+
}, [inputRef, isEditing]);
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1637",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@date-io/moment": "^1.3.5",
|
|
9
9
|
"@react-google-maps/api": "2.7.0",
|
|
10
|
-
"@reltio/mdm-module": "^1.4.
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
10
|
+
"@reltio/mdm-module": "^1.4.1637",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1637",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|