@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.
- package/components/CollaborationItem/CollaborationItem.js +9 -2
- package/components/CollaborationItem/Comment/Comment.d.ts +2 -1
- package/components/CollaborationItem/Comment/Comment.js +11 -7
- package/components/CollaborationItem/SendMessageArea/SendMessageArea.d.ts +4 -2
- package/components/CollaborationItem/SendMessageArea/SendMessageArea.js +63 -26
- package/components/CollaborationItem/TextFieldWithMentions/styles.js +1 -1
- package/components/DropDownMenuButton/MenuItemRenderer.js +1 -1
- package/components/PopupWithArrow/PopupWithArrow.js +9 -1
- package/components/ProfileBand/styles.d.ts +1 -1
- package/components/ReltioMap/EntityMarker/EntityMarker.d.ts +9 -0
- package/components/ReltioMap/EntityMarker/EntityMarker.js +91 -0
- package/components/ReltioMap/EntityMarker/styles.d.ts +1 -0
- package/components/ReltioMap/EntityMarker/styles.js +13 -0
- package/components/ReltioMap/MapControls/MapControlContainer/MapControlContrainer.d.ts +10 -0
- package/components/ReltioMap/MapControls/MapControlContainer/MapControlContrainer.js +28 -0
- package/components/ReltioMap/MapControls/TopCenterMapControls/TopCenterMapControls.d.ts +7 -0
- package/components/ReltioMap/MapControls/TopCenterMapControls/TopCenterMapControls.js +23 -0
- package/components/ReltioMap/MapControls/TopCenterMapControls/styles.d.ts +1 -0
- package/components/ReltioMap/MapControls/TopCenterMapControls/styles.js +27 -0
- package/components/ReltioMap/MapControls/TopRightMapControls/TopRightMapControls.d.ts +47 -0
- package/components/ReltioMap/MapControls/TopRightMapControls/TopRightMapControls.js +40 -0
- package/components/ReltioMap/MapControls/TopRightMapControls/styles.d.ts +1 -0
- package/components/ReltioMap/MapControls/TopRightMapControls/styles.js +22 -0
- package/components/ReltioMap/constants.d.ts +14 -0
- package/components/ReltioMap/constants.js +17 -0
- package/components/ReltioMap/helpers/index.d.ts +6 -0
- package/components/ReltioMap/helpers/index.js +63 -0
- package/components/ReltioMap/index.d.ts +27 -0
- package/components/ReltioMap/index.js +162 -0
- package/components/ReltioMap/styles.d.ts +1 -0
- package/components/ReltioMap/styles.js +12 -0
- package/components/ReltioMap/types.d.ts +23 -0
- package/components/ReltioMap/types.js +2 -0
- package/components/attributes/PivotingAttributes/PivotingTooltipContent.js +3 -1
- package/components/attributes/editMode/AttributesList/AttributesList.js +1 -1
- package/components/attributes/editMode/AttributesList/helpers.d.ts +1 -2
- package/components/attributes/editMode/AttributesList/helpers.js +1 -20
- package/components/attributes/editMode/AttributesPager/AttributeRenderer.js +4 -3
- package/components/attributes/editMode/AttributesPager/index.d.ts +4 -2
- package/components/attributes/editMode/AttributesPager/index.js +11 -20
- package/components/attributes/editMode/ComplexAttribute/ComplexAttribute.d.ts +3 -1
- package/components/attributes/editMode/ComplexAttribute/ComplexAttribute.js +19 -5
- package/components/attributes/editMode/ComplexAttribute/styles.d.ts +1 -1
- package/components/attributes/editMode/ComplexAttribute/styles.js +10 -2
- package/components/attributes/editMode/NestedAttribute/NestedAttribute.d.ts +1 -0
- package/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
- package/components/attributes/editMode/ReferenceAttribute/index.d.ts +1 -0
- package/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +15 -4
- package/components/attributes/editMode/SimpleAttributeEditor/styles.d.ts +1 -1
- package/components/attributes/editMode/SimpleAttributeEditor/styles.js +8 -0
- package/components/attributes/inline/ComplexAttribute/ComplexAttribute.js +1 -1
- package/components/attributes/readMode/AttributesPager/index.d.ts +3 -1
- package/components/attributes/readMode/AttributesPager/index.js +26 -2
- package/components/attributes/readMode/NestedAttribute/NestedAttribute.d.ts +1 -0
- package/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
- package/components/attributes/readMode/ReferenceAttribute/index.d.ts +1 -0
- package/components/crosswalks/CrosswalkAttributes/styles.js +3 -2
- package/components/crosswalks/CrosswalkEditor/CrosswalkEditor.d.ts +2 -1
- package/components/crosswalks/CrosswalkEditor/CrosswalkEditor.js +2 -2
- package/components/crosswalks/CrosswalkEditor/styles.d.ts +1 -1
- package/components/crosswalks/CrosswalkEditor/styles.js +0 -4
- package/components/crosswalks/hooks/useCrosswalkActions.d.ts +12 -0
- package/components/crosswalks/hooks/useCrosswalkActions.js +75 -0
- package/components/crosswalks/index.d.ts +2 -1
- package/components/crosswalks/index.js +3 -1
- package/components/crosswalks/types/AddCrosswalkEvent.d.ts +6 -0
- package/components/crosswalks/types/AddCrosswalkEvent.js +2 -0
- package/components/crosswalks/types/DeleteCrosswalkEvent.d.ts +4 -0
- package/components/crosswalks/types/DeleteCrosswalkEvent.js +2 -0
- package/components/crosswalks/types/EditCrosswalkEvent.d.ts +6 -0
- package/components/crosswalks/types/EditCrosswalkEvent.js +2 -0
- package/components/crosswalks/types/index.d.ts +3 -0
- package/components/index.d.ts +5 -1
- package/components/index.js +10 -3
- package/constants/index.d.ts +1 -0
- package/constants/index.js +5 -1
- package/constants/map.d.ts +14 -0
- package/constants/map.js +17 -0
- package/contexts/CollaborationContext/index.d.ts +7 -1
- package/contexts/CollaborationContext/index.js +4 -2
- package/contexts/EntityMarkerContext/index.d.ts +6 -0
- package/contexts/EntityMarkerContext/index.js +9 -0
- package/contexts/index.d.ts +1 -0
- package/contexts/index.js +3 -1
- package/hooks/useCollaboration.d.ts +4 -2
- package/hooks/useCollaboration.js +56 -7
- package/hooks/useRelationsLoader.js +3 -1
- package/package.json +3 -3
|
@@ -33,14 +33,21 @@ var CollaborationItem = function (_a) {
|
|
|
33
33
|
var uri = _a.uri, relatedObjectUris = _a.relatedObjectUris, objectType = _a.objectType, classes = _a.classes, popperRef = _a.popperRef, messagesRef = _a.messagesRef, comment = _a.comment;
|
|
34
34
|
var inputRef = react_1.useRef();
|
|
35
35
|
var styles = styles_1.useStyles({ classes: classes });
|
|
36
|
+
var _b = react_1.useState(false), isEditingComment = _b[0], setIsEditingComment = _b[1];
|
|
36
37
|
var handleReply = function () {
|
|
38
|
+
if (isEditingComment) {
|
|
39
|
+
setIsEditingComment(false);
|
|
40
|
+
}
|
|
37
41
|
inputRef.current.focus();
|
|
38
42
|
};
|
|
39
|
-
var
|
|
43
|
+
var handleSetEdit = function () {
|
|
44
|
+
setIsEditingComment(true);
|
|
45
|
+
};
|
|
46
|
+
var sendMessageArea = (react_1.default.createElement(SendMessageArea_1.SendMessageArea, { className: styles.sendMessageArea, inputRef: inputRef, popperRef: popperRef, uri: uri, relatedObjectUris: relatedObjectUris, objectType: objectType, comment: comment, onCancel: function () { return setIsEditingComment(false); }, isEditingComment: isEditingComment }));
|
|
40
47
|
return (react_1.default.createElement(Box_1.default, { className: styles.root },
|
|
41
48
|
comment && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
42
49
|
react_1.default.createElement("div", { className: styles.messages, ref: messagesRef },
|
|
43
|
-
react_1.default.createElement(Comment_1.Comment, { comment: comment, uri: uri, onReply: handleReply, className: styles.comment }),
|
|
50
|
+
react_1.default.createElement(Comment_1.Comment, { comment: comment, uri: uri, onReply: handleReply, onStartEditing: handleSetEdit, className: styles.comment }),
|
|
44
51
|
react_1.default.createElement(Box_1.default, { className: styles.replies }, comment.replies.map(function (reply) { return (react_1.default.createElement(RepliedComment_1.RepliedComment, { key: reply.replyId, className: styles.repliedComment, reply: reply })); }))),
|
|
45
52
|
sendMessageArea)),
|
|
46
53
|
!comment && sendMessageArea));
|
|
@@ -5,6 +5,7 @@ declare type Props = {
|
|
|
5
5
|
onReply: () => void;
|
|
6
6
|
className?: string;
|
|
7
7
|
comment: CommentType;
|
|
8
|
+
onStartEditing: () => void;
|
|
8
9
|
};
|
|
9
|
-
export declare const Comment: ({ onReply, className, uri, comment }: Props) => JSX.Element;
|
|
10
|
+
export declare const Comment: ({ onReply, className, uri, comment, onStartEditing }: Props) => JSX.Element;
|
|
10
11
|
export {};
|
|
@@ -37,20 +37,24 @@ var Avatar_1 = require("../Avatar/Avatar");
|
|
|
37
37
|
var contexts_1 = require("../../../contexts");
|
|
38
38
|
var utils_1 = require("../utils");
|
|
39
39
|
var styles_1 = require("./styles");
|
|
40
|
+
var react_redux_1 = require("react-redux");
|
|
41
|
+
var mdm_module_1 = __importDefault(require("@reltio/mdm-module"));
|
|
40
42
|
var Comment = function (_a) {
|
|
41
|
-
var onReply = _a.onReply, className = _a.className, uri = _a.uri, comment = _a.comment;
|
|
43
|
+
var onReply = _a.onReply, className = _a.className, uri = _a.uri, comment = _a.comment, onStartEditing = _a.onStartEditing;
|
|
42
44
|
var styles = styles_1.useStyles();
|
|
43
|
-
var
|
|
45
|
+
var username = react_redux_1.useSelector(mdm_module_1.default.selectors.getUserName);
|
|
46
|
+
var canChangeComment = comment.createdBy === username;
|
|
47
|
+
var _b = react_1.useContext(contexts_1.CollaborationContext), resolveThread = _b.resolveThread, reOpenThread = _b.reOpenThread, sending = _b.sending, deleteComment = _b.deleteComment;
|
|
44
48
|
var menuItems = react_1.useMemo(function () { return [
|
|
45
49
|
{
|
|
46
50
|
text: ui_i18n_1.default.text('Edit'),
|
|
47
|
-
onClick:
|
|
51
|
+
onClick: onStartEditing
|
|
48
52
|
},
|
|
49
53
|
{
|
|
50
54
|
text: ui_i18n_1.default.text('Delete'),
|
|
51
|
-
onClick: function () { }
|
|
55
|
+
onClick: function () { return deleteComment({ uri: uri, commentId: comment.commentId }); }
|
|
52
56
|
}
|
|
53
|
-
]; }, []);
|
|
57
|
+
]; }, [onStartEditing, deleteComment, uri, comment]);
|
|
54
58
|
var handleResolve = function () {
|
|
55
59
|
resolveThread({ commentId: comment.commentId, uri: uri });
|
|
56
60
|
};
|
|
@@ -63,10 +67,10 @@ var Comment = function (_a) {
|
|
|
63
67
|
react_1.default.createElement(Box_1.default, { width: "100%" },
|
|
64
68
|
react_1.default.createElement(Typography_1.default, { className: styles.username }, comment.createdBy)),
|
|
65
69
|
react_1.default.createElement(Typography_1.default, { className: styles.createdAt }, utils_1.formatDate(comment.createdTime)),
|
|
66
|
-
react_1.default.createElement(DropDownMenuButton_1.default, { buttonComponent: SmallIconButton_1.SmallIconButtonWithTooltip, buttonProps: {
|
|
70
|
+
canChangeComment && (react_1.default.createElement(DropDownMenuButton_1.default, { buttonComponent: SmallIconButton_1.SmallIconButtonWithTooltip, buttonProps: {
|
|
67
71
|
icon: MoreVert_1.default,
|
|
68
72
|
tooltipTitle: ui_i18n_1.default.text('Open menu')
|
|
69
|
-
}, popoverProps: { PopoverClasses: { root: styles.dropdownMenu } }, menuItems: menuItems, menuId: "collaboration-comment-menu" })),
|
|
73
|
+
}, popoverProps: { PopoverClasses: { root: styles.dropdownMenu } }, menuItems: menuItems, menuId: "collaboration-comment-menu" }))),
|
|
70
74
|
react_1.default.createElement(Box_1.default, { className: styles.body },
|
|
71
75
|
react_1.default.createElement(CommentTarget_1.CommentTarget, { comment: comment, className: styles.commentTarget }),
|
|
72
76
|
react_1.default.createElement(CommentContent_1.CommentContent, { comment: comment, className: styles.message }),
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Comment } from '@reltio/mdm-sdk';
|
|
3
3
|
declare type Props = {
|
|
4
|
-
inputRef: React.
|
|
4
|
+
inputRef: React.RefObject<HTMLInputElement>;
|
|
5
5
|
className?: string;
|
|
6
6
|
uri: string;
|
|
7
7
|
objectType: Comment['objectType'];
|
|
8
8
|
relatedObjectUris: Comment['relatedObjectUris'];
|
|
9
9
|
popperRef?: React.RefObject<any>;
|
|
10
10
|
comment?: Comment;
|
|
11
|
+
isEditingComment?: boolean;
|
|
12
|
+
onCancel?: () => void;
|
|
11
13
|
};
|
|
12
|
-
export declare const SendMessageArea: ({ inputRef, className, uri, relatedObjectUris, objectType, popperRef, comment }: Props) => JSX.Element;
|
|
14
|
+
export declare const SendMessageArea: ({ inputRef, className, uri, relatedObjectUris, objectType, popperRef, comment, isEditingComment, onCancel }: Props) => JSX.Element;
|
|
13
15
|
export {};
|
|
@@ -34,6 +34,7 @@ var TextFieldWithMentions_1 = require("../TextFieldWithMentions/TextFieldWithMen
|
|
|
34
34
|
var Avatar_1 = require("../Avatar/Avatar");
|
|
35
35
|
var contexts_1 = require("../../../contexts");
|
|
36
36
|
var styles_1 = require("./styles");
|
|
37
|
+
var ramda_1 = require("ramda");
|
|
37
38
|
var getPlaceholder = function (status) {
|
|
38
39
|
switch (status) {
|
|
39
40
|
case 'open':
|
|
@@ -44,30 +45,36 @@ var getPlaceholder = function (status) {
|
|
|
44
45
|
return '';
|
|
45
46
|
}
|
|
46
47
|
};
|
|
47
|
-
var getButtonText = function (status) {
|
|
48
|
+
var getButtonText = function (status, isEditingComment) {
|
|
49
|
+
if (isEditingComment) {
|
|
50
|
+
return ui_i18n_1.default.text('Edit');
|
|
51
|
+
}
|
|
48
52
|
if (status === 'open' || status === 'resolved') {
|
|
49
53
|
return ui_i18n_1.default.text('Reply');
|
|
50
54
|
}
|
|
51
55
|
return ui_i18n_1.default.text('Comment');
|
|
52
56
|
};
|
|
53
57
|
var SendMessageArea = function (_a) {
|
|
54
|
-
var inputRef = _a.inputRef, className = _a.className, uri = _a.uri, relatedObjectUris = _a.relatedObjectUris, objectType = _a.objectType, popperRef = _a.popperRef, comment = _a.comment;
|
|
58
|
+
var inputRef = _a.inputRef, className = _a.className, uri = _a.uri, relatedObjectUris = _a.relatedObjectUris, objectType = _a.objectType, popperRef = _a.popperRef, comment = _a.comment, isEditingComment = _a.isEditingComment, onCancel = _a.onCancel;
|
|
55
59
|
var styles = styles_1.useStyles();
|
|
56
60
|
var username = react_redux_1.useSelector(mdm_module_1.default.selectors.getUserName);
|
|
57
|
-
var _b = react_1.useContext(contexts_1.CollaborationContext), createReply = _b.createReply, createComment = _b.createComment, sending = _b.sending;
|
|
61
|
+
var _b = react_1.useContext(contexts_1.CollaborationContext), createReply = _b.createReply, createComment = _b.createComment, sending = _b.sending, editComment = _b.editComment;
|
|
58
62
|
var _c = react_1.useState(''), value = _c[0], setValue = _c[1];
|
|
59
63
|
var _d = react_1.useState(''), plainTextValue = _d[0], setPlainTextValue = _d[1];
|
|
60
64
|
var _e = react_1.useState([]), mentions = _e[0], setMentions = _e[1];
|
|
61
65
|
var _f = react_1.useState(false), focused = _f[0], setFocused = _f[1];
|
|
62
66
|
var hasValue = value.trim() !== '';
|
|
63
|
-
var shouldShowButtons = focused || hasValue
|
|
67
|
+
var shouldShowButtons = focused || hasValue;
|
|
64
68
|
var status = comment === null || comment === void 0 ? void 0 : comment.status;
|
|
65
69
|
var updateValue = function (value, plainTextValue, mentions) {
|
|
66
70
|
setMentions(mentions);
|
|
67
71
|
setValue(value);
|
|
68
72
|
setPlainTextValue(plainTextValue);
|
|
69
73
|
};
|
|
70
|
-
var clearValue = function () {
|
|
74
|
+
var clearValue = function () {
|
|
75
|
+
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
76
|
+
updateValue('', '', []);
|
|
77
|
+
};
|
|
71
78
|
var handleChange = function (newValue, newPlainTextValue, mentions) {
|
|
72
79
|
updateValue(newValue, newPlainTextValue, mentions);
|
|
73
80
|
};
|
|
@@ -76,38 +83,68 @@ var SendMessageArea = function (_a) {
|
|
|
76
83
|
var handleBlur = function () { return setFocused(false); };
|
|
77
84
|
var handleSubmit = function (e) {
|
|
78
85
|
e.preventDefault();
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
86
|
+
var request = ramda_1.cond([
|
|
87
|
+
[
|
|
88
|
+
ramda_1.always(!comment),
|
|
89
|
+
function () {
|
|
90
|
+
return createComment({
|
|
91
|
+
content: plainTextValue,
|
|
92
|
+
namedUsers: mentions,
|
|
93
|
+
objectType: objectType,
|
|
94
|
+
uri: uri,
|
|
95
|
+
relatedObjectUris: relatedObjectUris
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
[
|
|
100
|
+
ramda_1.always(isEditingComment),
|
|
101
|
+
function () {
|
|
102
|
+
return editComment({
|
|
103
|
+
content: plainTextValue,
|
|
104
|
+
namedUsers: mentions,
|
|
105
|
+
commentId: comment.commentId,
|
|
106
|
+
objectType: objectType,
|
|
107
|
+
replies: comment.replies,
|
|
108
|
+
relatedObjectUris: relatedObjectUris,
|
|
109
|
+
uri: uri
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
ramda_1.T,
|
|
115
|
+
function () {
|
|
116
|
+
return createReply({
|
|
117
|
+
content: plainTextValue,
|
|
118
|
+
namedUsers: mentions,
|
|
119
|
+
commentId: comment.commentId,
|
|
120
|
+
action: comment.status === 'open' ? 'none' : 'reopen',
|
|
121
|
+
uri: uri
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
]);
|
|
126
|
+
return request().then(clearValue).catch(console.log); //eslint-disable-line no-console
|
|
98
127
|
};
|
|
99
128
|
react_1.useEffect(function () {
|
|
100
129
|
if (popperRef) {
|
|
101
130
|
popperRef.current.update();
|
|
102
131
|
}
|
|
103
132
|
}, [popperRef, shouldShowButtons]);
|
|
133
|
+
react_1.useEffect(function () {
|
|
134
|
+
if (isEditingComment) {
|
|
135
|
+
setValue(comment.content);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
clearValue();
|
|
139
|
+
}
|
|
140
|
+
}, [isEditingComment]);
|
|
104
141
|
return (react_1.default.createElement(Box_1.default, { className: classnames_1.default(styles.root, className) },
|
|
105
142
|
react_1.default.createElement("form", { onSubmit: handleSubmit, className: styles.form },
|
|
106
143
|
react_1.default.createElement(Box_1.default, { className: styles.main },
|
|
107
144
|
react_1.default.createElement(Avatar_1.Avatar, { classes: { root: styles.avatar } }, username),
|
|
108
|
-
react_1.default.createElement(TextFieldWithMentions_1.TextFieldWithMentions, { className: styles.textField,
|
|
145
|
+
react_1.default.createElement(TextFieldWithMentions_1.TextFieldWithMentions, { className: styles.textField, disabled: sending, onChange: handleChange, inputRef: inputRef, value: value, onFocus: handleFocus, onBlur: handleBlur, placeholder: getPlaceholder(status) })),
|
|
109
146
|
shouldShowButtons && (react_1.default.createElement(Box_1.default, { className: styles.buttons },
|
|
110
|
-
react_1.default.createElement(Button_1.default, { className: styles.button, variant: "contained", color: "primary", disabled: !hasValue || sending, type: "submit" }, getButtonText(status)),
|
|
147
|
+
react_1.default.createElement(Button_1.default, { className: styles.button, variant: "contained", color: "primary", disabled: !hasValue || sending, type: "submit" }, getButtonText(status, isEditingComment)),
|
|
111
148
|
react_1.default.createElement(Button_1.default, { disabled: sending, onClick: handleCancel, className: styles.button, variant: "outlined", color: "primary" }, ui_i18n_1.default.text('Cancel')))))));
|
|
112
149
|
};
|
|
113
150
|
exports.SendMessageArea = SendMessageArea;
|
|
@@ -28,7 +28,7 @@ exports.useStyles = styles_1.makeStyles(function (theme) { return ({
|
|
|
28
28
|
borderRadius: '4px',
|
|
29
29
|
backgroundColor: '#fafafa !important',
|
|
30
30
|
boxShadow: '0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2)',
|
|
31
|
-
transform: 'translateY(-
|
|
31
|
+
transform: 'translateY(-100%)'
|
|
32
32
|
},
|
|
33
33
|
'&__suggestions__list': {
|
|
34
34
|
maxHeight: '200px',
|
|
@@ -37,7 +37,7 @@ var MenuItemRenderer = react_1.forwardRef(function (_a, ref) {
|
|
|
37
37
|
onMenuClose(e);
|
|
38
38
|
onClick(e);
|
|
39
39
|
};
|
|
40
|
-
return (react_1.default.createElement(MenuItemWithTooltip, { tooltipTitle: tooltip, showForDisabled: true, classes: { root: styles.menuItem }, onClick: handleClick, disabled: disabled, ref: ref, "data-reltio-id": "reltio-search-menu-item" + id },
|
|
40
|
+
return (react_1.default.createElement(MenuItemWithTooltip, { tooltipTitle: tooltip, showForDisabled: true, classes: { root: styles.menuItem }, onClick: handleClick, disabled: disabled, ref: ref, "data-modal": true, "data-reltio-id": "reltio-search-menu-item" + id },
|
|
41
41
|
react_1.default.createElement(Typography_1.default, { classes: { root: styles.menuText } }, text)));
|
|
42
42
|
});
|
|
43
43
|
MenuItemRenderer.displayName = 'MenuItemRenderer';
|
|
@@ -11,10 +11,18 @@ var ClickAwayListener_1 = __importDefault(require("@material-ui/core/ClickAwayLi
|
|
|
11
11
|
var Box_1 = __importDefault(require("@material-ui/core/Box"));
|
|
12
12
|
var Popper_1 = __importDefault(require("../Popper/Popper"));
|
|
13
13
|
var styles_1 = require("./styles");
|
|
14
|
+
var isChildOfPortalModal = function (child) {
|
|
15
|
+
return Array.from(document.querySelectorAll('[data-modal]')).some(function (el) { return el.contains(child); });
|
|
16
|
+
};
|
|
14
17
|
var PopupWithArrow = function (_a) {
|
|
15
18
|
var anchorEl = _a.anchorEl, _b = _a.placement, placement = _b === void 0 ? 'top' : _b, _c = _a.arrow, arrow = _c === void 0 ? true : _c, open = _a.open, _d = _a.onClose, onClose = _d === void 0 ? function () { } : _d, children = _a.children, className = _a.className, popperRef = _a.popperRef;
|
|
16
19
|
var styles = styles_1.useStyles();
|
|
17
20
|
var _e = react_1.default.useState(null), arrowRef = _e[0], setArrowRef = _e[1];
|
|
21
|
+
var onClickOutside = function (e) {
|
|
22
|
+
if (!isChildOfPortalModal(e.target)) {
|
|
23
|
+
onClose();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
18
26
|
return (react_1.default.createElement(Popper_1.default, { anchorEl: anchorEl, placement: placement, className: classnames_1.default(styles.popper, className), modifiers: {
|
|
19
27
|
preventOverflow: {
|
|
20
28
|
enabled: true,
|
|
@@ -26,7 +34,7 @@ var PopupWithArrow = function (_a) {
|
|
|
26
34
|
}
|
|
27
35
|
}, open: open, modal: false, popperRef: popperRef },
|
|
28
36
|
react_1.default.createElement(Box_1.default, null,
|
|
29
|
-
react_1.default.createElement(ClickAwayListener_1.default, { onClickAway:
|
|
37
|
+
react_1.default.createElement(ClickAwayListener_1.default, { onClickAway: onClickOutside },
|
|
30
38
|
react_1.default.createElement(Paper_1.default, { className: styles.popoverRoot },
|
|
31
39
|
arrow ? react_1.default.createElement("span", { className: styles.arrow, ref: setArrowRef }) : null,
|
|
32
40
|
react_1.default.createElement(Box_1.default, null, children))))));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export default useStyles;
|
|
2
|
-
declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "
|
|
2
|
+
declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "secondaryLabel" | "entityType" | "inactive" | "profileIcon" | "badge" | "profileBandWrapper" | "profileBand" | "imageProfileIcon" | "profileInfo" | "businessCard" | "specialInfo" | "entityId" | "scores">;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MarkerProps } from '@react-google-maps/api';
|
|
3
|
+
import { EntityMarker as EntityMarkerType } from '../types';
|
|
4
|
+
declare type Props = {
|
|
5
|
+
marker: EntityMarkerType;
|
|
6
|
+
onClick: (marker: EntityMarkerType) => void;
|
|
7
|
+
} & Omit<MarkerProps, 'onClick' | 'icon' | 'position' | 'visible' | 'onMouseOver' | 'onMouseOut'>;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<({ marker, onClick, ...otherProps }: Props) => JSX.Element>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
33
|
+
var t = {};
|
|
34
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
35
|
+
t[p] = s[p];
|
|
36
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
37
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
38
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
39
|
+
t[p[i]] = s[p[i]];
|
|
40
|
+
}
|
|
41
|
+
return t;
|
|
42
|
+
};
|
|
43
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
44
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
var react_1 = __importStar(require("react"));
|
|
48
|
+
var ramda_1 = require("ramda");
|
|
49
|
+
var api_1 = require("@react-google-maps/api");
|
|
50
|
+
var ProfileCard_1 = __importDefault(require("../../ProfileCard/ProfileCard"));
|
|
51
|
+
var Popper_1 = __importDefault(require("../../Popper/Popper"));
|
|
52
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
53
|
+
var contexts_1 = require("../../../contexts");
|
|
54
|
+
var marker_inline_svg_1 = __importDefault(require("./icons/marker.inline.svg"));
|
|
55
|
+
var marker_hover_inline_svg_1 = __importDefault(require("./icons/marker-hover.inline.svg"));
|
|
56
|
+
var styles_1 = require("./styles");
|
|
57
|
+
var HIDE_DEBOUNCE_INTERVAL = 50;
|
|
58
|
+
var MARKER_WIDTH = 22;
|
|
59
|
+
var MARKER_HEIGHT = 32;
|
|
60
|
+
var MARKER_CARD_MARGIN = 8;
|
|
61
|
+
var EntityMarker = function (_a) {
|
|
62
|
+
var marker = _a.marker, onClick = _a.onClick, otherProps = __rest(_a, ["marker", "onClick"]);
|
|
63
|
+
var styles = styles_1.useStyles();
|
|
64
|
+
var popperAnchor = react_1.useRef();
|
|
65
|
+
var _b = react_1.useState(false), hovered = _b[0], setHovered = _b[1];
|
|
66
|
+
var activeEntityUri = react_1.useContext(contexts_1.EntityMarkerContext).activeEntityUri;
|
|
67
|
+
var isActive = ramda_1.pathEq(['entity', 'uri'], activeEntityUri, marker);
|
|
68
|
+
var position = { lat: marker.point.lat, lng: marker.point.lng };
|
|
69
|
+
var setHoveredDebounced = react_1.useCallback(mdm_sdk_1.debounce(setHovered, HIDE_DEBOUNCE_INTERVAL), []);
|
|
70
|
+
var onMouseOver = react_1.useCallback(function () { return setHoveredDebounced(true); }, [setHoveredDebounced]);
|
|
71
|
+
var onMouseOut = react_1.useCallback(function () { return setHoveredDebounced(false); }, [setHoveredDebounced]);
|
|
72
|
+
var handleClick = react_1.useCallback(function () { return onClick(marker); }, [onClick, marker]);
|
|
73
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
74
|
+
react_1.default.createElement(Popper_1.default, { anchorEl: popperAnchor.current, open: hovered, className: styles.popper, modal: false, placement: "top" },
|
|
75
|
+
react_1.default.createElement(ProfileCard_1.default, { entity: marker.entity, onMouseOver: onMouseOver, onMouseOut: onMouseOut })),
|
|
76
|
+
react_1.default.createElement(api_1.Marker, __assign({ icon: {
|
|
77
|
+
url: hovered || isActive ? marker_hover_inline_svg_1.default : marker_inline_svg_1.default,
|
|
78
|
+
// needed for IE:
|
|
79
|
+
scaledSize: new google.maps.Size(MARKER_WIDTH, MARKER_HEIGHT) //eslint-disable-line
|
|
80
|
+
}, position: position, onClick: handleClick, visible: marker.visible !== false, onMouseOver: onMouseOver, onMouseOut: onMouseOut }, otherProps)),
|
|
81
|
+
react_1.default.createElement(api_1.InfoBox, { options: {
|
|
82
|
+
alignBottom: true,
|
|
83
|
+
pane: 'mapPane',
|
|
84
|
+
pixelOffset: new google.maps.Size(0, -(MARKER_HEIGHT + MARKER_CARD_MARGIN)),
|
|
85
|
+
closeBoxURL: '',
|
|
86
|
+
enableEventPropagation: true,
|
|
87
|
+
disableAutoPan: true
|
|
88
|
+
}, position: position },
|
|
89
|
+
react_1.default.createElement("span", { ref: popperAnchor }))));
|
|
90
|
+
};
|
|
91
|
+
exports.default = react_1.memo(EntityMarker);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"popper">;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
var styles_1 = require("@material-ui/core/styles");
|
|
5
|
+
exports.useStyles = styles_1.makeStyles({
|
|
6
|
+
popper: {
|
|
7
|
+
maxWidth: '263px',
|
|
8
|
+
minWidth: '150px',
|
|
9
|
+
boxShadow: '0 1px 1px 0 rgba(0,0,0,0.14), 0 2px 1px -1px rgba(0,0,0,0.12), 0 1px 3px 0 rgba(0,0,0,0.2)',
|
|
10
|
+
backgroundColor: 'white',
|
|
11
|
+
borderRadius: '2px'
|
|
12
|
+
}
|
|
13
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MapInstance } from '../../types';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
position: number;
|
|
7
|
+
map: MapInstance;
|
|
8
|
+
};
|
|
9
|
+
export declare const MapControlContainer: ({ children, className, position, map }: Props) => React.ReactPortal;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MapControlContainer = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var react_dom_1 = require("react-dom");
|
|
6
|
+
var MapControlContainer = function (_a) {
|
|
7
|
+
var children = _a.children, className = _a.className, position = _a.position, map = _a.map;
|
|
8
|
+
var _b = react_1.useState(null), controlElement = _b[0], setControlElement = _b[1];
|
|
9
|
+
react_1.useEffect(function () {
|
|
10
|
+
var controlDiv = document.createElement('div');
|
|
11
|
+
var divIndex = map.controls[position].length;
|
|
12
|
+
map.controls[position].push(controlDiv);
|
|
13
|
+
setControlElement(controlDiv);
|
|
14
|
+
return function () {
|
|
15
|
+
map.controls[position].removeAt(divIndex);
|
|
16
|
+
};
|
|
17
|
+
}, [map, position]);
|
|
18
|
+
react_1.useEffect(function () {
|
|
19
|
+
if (controlElement && className) {
|
|
20
|
+
controlElement.classList.add(className);
|
|
21
|
+
}
|
|
22
|
+
}, [className, controlElement]);
|
|
23
|
+
if (controlElement) {
|
|
24
|
+
return react_dom_1.createPortal(children, controlElement);
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
};
|
|
28
|
+
exports.MapControlContainer = MapControlContainer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Props = {
|
|
3
|
+
isSearchOnMapMove: boolean;
|
|
4
|
+
onChangeIsSearchOnMapMove: (value: boolean) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const TopCenterMapControls: ({ isSearchOnMapMove, onChangeIsSearchOnMapMove }: Props) => JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
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.TopCenterMapControls = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
9
|
+
var FormControlLabel_1 = __importDefault(require("@material-ui/core/FormControlLabel"));
|
|
10
|
+
var Checkbox_1 = __importDefault(require("@material-ui/core/Checkbox"));
|
|
11
|
+
var styles_1 = require("./styles");
|
|
12
|
+
var TopCenterMapControls = function (_a) {
|
|
13
|
+
var isSearchOnMapMove = _a.isSearchOnMapMove, onChangeIsSearchOnMapMove = _a.onChangeIsSearchOnMapMove;
|
|
14
|
+
var styles = styles_1.useStyles();
|
|
15
|
+
var onChange = function (event) {
|
|
16
|
+
onChangeIsSearchOnMapMove(event.target.checked);
|
|
17
|
+
};
|
|
18
|
+
return (react_1.default.createElement(FormControlLabel_1.default, { classes: {
|
|
19
|
+
root: styles.container,
|
|
20
|
+
label: styles.label
|
|
21
|
+
}, control: react_1.default.createElement(Checkbox_1.default, { checked: isSearchOnMapMove, onChange: onChange, color: "primary", className: styles.checkbox }), label: ui_i18n_1.default.text('Search as I move the map') }));
|
|
22
|
+
};
|
|
23
|
+
exports.TopCenterMapControls = TopCenterMapControls;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "checkbox" | "container">;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
var styles_1 = require("@material-ui/core/styles");
|
|
5
|
+
exports.useStyles = styles_1.makeStyles({
|
|
6
|
+
container: {
|
|
7
|
+
height: '28px',
|
|
8
|
+
marginRight: '7px',
|
|
9
|
+
marginLeft: 0
|
|
10
|
+
},
|
|
11
|
+
label: {
|
|
12
|
+
fontSize: '11px',
|
|
13
|
+
alignSelf: 'center',
|
|
14
|
+
lineHeight: '13px',
|
|
15
|
+
marginLeft: '2px',
|
|
16
|
+
letterSpacing: 0
|
|
17
|
+
},
|
|
18
|
+
checkbox: {
|
|
19
|
+
width: '20px',
|
|
20
|
+
height: '20px',
|
|
21
|
+
padding: '5px',
|
|
22
|
+
'& svg': {
|
|
23
|
+
width: '16px',
|
|
24
|
+
height: '16px'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DrawingMode, DrawingModes } from '../../types';
|
|
3
|
+
export declare const ButtonWithTooltip: React.ForwardRefExoticComponent<import("prop-types").InferPropsInner<Pick<{
|
|
4
|
+
tooltipTitle: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
5
|
+
tooltipPlacement: import("prop-types").Requireable<string>;
|
|
6
|
+
showForDisabled: import("prop-types").Requireable<boolean>;
|
|
7
|
+
}, never>> & Partial<import("prop-types").InferPropsInner<Pick<{
|
|
8
|
+
tooltipTitle: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
9
|
+
tooltipPlacement: import("prop-types").Requireable<string>;
|
|
10
|
+
showForDisabled: import("prop-types").Requireable<boolean>;
|
|
11
|
+
}, "tooltipTitle" | "tooltipPlacement" | "showForDisabled">>> & {
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
color?: import("@material-ui/core").PropTypes.Color;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
disableElevation?: boolean;
|
|
16
|
+
disableFocusRipple?: boolean;
|
|
17
|
+
endIcon?: React.ReactNode;
|
|
18
|
+
fullWidth?: boolean;
|
|
19
|
+
href?: string;
|
|
20
|
+
size?: "medium" | "large" | "small";
|
|
21
|
+
startIcon?: React.ReactNode;
|
|
22
|
+
variant?: "text" | "outlined" | "contained";
|
|
23
|
+
} & {
|
|
24
|
+
action?: React.Ref<import("@material-ui/core").ButtonBaseActions>;
|
|
25
|
+
buttonRef?: React.Ref<unknown>;
|
|
26
|
+
centerRipple?: boolean;
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
disableRipple?: boolean;
|
|
30
|
+
disableTouchRipple?: boolean;
|
|
31
|
+
focusRipple?: boolean;
|
|
32
|
+
focusVisibleClassName?: string;
|
|
33
|
+
onFocusVisible?: React.FocusEventHandler<any>;
|
|
34
|
+
tabIndex?: string | number;
|
|
35
|
+
TouchRippleProps?: Partial<import("@material-ui/core/ButtonBase/TouchRipple").TouchRippleProps>;
|
|
36
|
+
} & import("@material-ui/core/OverridableComponent").CommonProps<import("@material-ui/core").ExtendButtonBaseTypeMap<import("@material-ui/core/Button").ButtonTypeMap<{}, "button">>> & Pick<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
37
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
38
|
+
}, "type" | "hidden" | "name" | "prefix" | "value" | "defaultValue" | "id" | "title" | "translate" | "ref" | "onScroll" | "form" | "slot" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "placeholder" | "spellCheck" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget">>;
|
|
39
|
+
declare type Props = {
|
|
40
|
+
onDrawingModeChanged: (value: DrawingMode | null) => void;
|
|
41
|
+
drawingMode: DrawingMode | null;
|
|
42
|
+
drawingModes: DrawingModes;
|
|
43
|
+
hasActiveOverlay: boolean;
|
|
44
|
+
onClearOverlay: () => void;
|
|
45
|
+
};
|
|
46
|
+
export declare const TopRightMapControls: ({ drawingMode, drawingModes, hasActiveOverlay, onDrawingModeChanged, onClearOverlay }: Props) => JSX.Element;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
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.TopRightMapControls = exports.ButtonWithTooltip = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
9
|
+
var Button_1 = __importDefault(require("@material-ui/core/Button"));
|
|
10
|
+
var HOCs_1 = require("../../../../HOCs");
|
|
11
|
+
var HighlightOff_1 = __importDefault(require("@material-ui/icons/HighlightOff"));
|
|
12
|
+
var constants_1 = require("../../constants");
|
|
13
|
+
var radius_svg_1 = __importDefault(require("./icons/radius.svg"));
|
|
14
|
+
var draw_svg_1 = __importDefault(require("./icons/draw.svg"));
|
|
15
|
+
var styles_1 = require("./styles");
|
|
16
|
+
exports.ButtonWithTooltip = HOCs_1.withTooltip(Button_1.default);
|
|
17
|
+
var getIcon = function (mode) {
|
|
18
|
+
switch (mode) {
|
|
19
|
+
case constants_1.MAP_DRAWING_MODES.CIRCLE:
|
|
20
|
+
return radius_svg_1.default;
|
|
21
|
+
case constants_1.MAP_DRAWING_MODES.POLYGON:
|
|
22
|
+
return draw_svg_1.default;
|
|
23
|
+
default:
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var TopRightMapControls = function (_a) {
|
|
28
|
+
var drawingMode = _a.drawingMode, _b = _a.drawingModes, drawingModes = _b === void 0 ? [] : _b, hasActiveOverlay = _a.hasActiveOverlay, onDrawingModeChanged = _a.onDrawingModeChanged, onClearOverlay = _a.onClearOverlay;
|
|
29
|
+
var styles = styles_1.useStyles();
|
|
30
|
+
var changeDrawingModeTo = function (drawingMode) { return function () {
|
|
31
|
+
onDrawingModeChanged(drawingMode);
|
|
32
|
+
}; };
|
|
33
|
+
return (react_1.default.createElement("div", { className: styles.container }, drawingMode || hasActiveOverlay ? (react_1.default.createElement(exports.ButtonWithTooltip, { tooltipTitle: ui_i18n_1.default.text('Clear area'), className: styles.button, onClick: hasActiveOverlay ? onClearOverlay : changeDrawingModeTo(null) },
|
|
34
|
+
react_1.default.createElement(HighlightOff_1.default, { className: styles.icon }))) : (drawingModes.map(function (mode) {
|
|
35
|
+
var Icon = getIcon(mode);
|
|
36
|
+
return (react_1.default.createElement(exports.ButtonWithTooltip, { tooltipTitle: ui_i18n_1.default.text('Draw area'), key: mode, className: styles.button, onClick: changeDrawingModeTo(mode) },
|
|
37
|
+
react_1.default.createElement(Icon, { className: styles.icon })));
|
|
38
|
+
}))));
|
|
39
|
+
};
|
|
40
|
+
exports.TopRightMapControls = TopRightMapControls;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"button" | "icon" | "container">;
|