@reltio/components 1.4.1655 → 1.4.1656

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.
@@ -66,6 +66,18 @@ var WorkflowComments = function (_a) {
66
66
  setComment('');
67
67
  }, [comment, writeComment]);
68
68
  var onChange = (0, ramda_1.pipe)(getValue, setComment);
69
+ var onKeyPressHandler = function (e) {
70
+ if (e.key === 'Enter') {
71
+ if (comment.length > 0 && !e.shiftKey) {
72
+ e.preventDefault();
73
+ sendComment();
74
+ }
75
+ if (comment.length > 0 && e.shiftKey) {
76
+ return;
77
+ }
78
+ e.preventDefault();
79
+ }
80
+ };
69
81
  var BUTTONS_GROUP = (0, react_1.useMemo)(function () { return __spreadArray([], actions.map(function (_a) {
70
82
  var text = _a.text, onClick = _a.onClick;
71
83
  return ({
@@ -83,8 +95,8 @@ var WorkflowComments = function (_a) {
83
95
  ui_i18n_1.default.text('Comments'),
84
96
  " "),
85
97
  react_1.default.createElement("div", { className: styles.commentsContainer }, expanded || comments.length < 3 ? (react_1.default.createElement(ExpandedComments_1.ExpandedComments, { comments: comments })) : (react_1.default.createElement(CollapsedComments_1.CollapsedComments, { onClick: function () { return setExpanded(true); }, comments: comments }))),
86
- !readOnly && (react_1.default.createElement(Input_1.default, { endAdornment: react_1.default.createElement(InputAdornment_1.default, { position: "end" },
87
- react_1.default.createElement(SmallIconButton_1.SmallIconButton, { icon: Send_1.default, disabled: comment.length === 0, onClick: sendComment, "data-reltio-id": "send-button" })), classes: { root: styles.filledInputRoot }, placeholder: ui_i18n_1.default.text('Write a comment'), value: comment, onKeyPress: (0, ramda_1.when)((0, ramda_1.allPass)([(0, ramda_1.propEq)('key', 'Enter'), (0, ramda_1.always)(comment.length > 0), (0, ramda_1.propEq)('shiftKey', false)]), sendComment), onChange: onChange, disableUnderline: true, multiline: true })),
98
+ !readOnly && (react_1.default.createElement(Input_1.default, { endAdornment: react_1.default.createElement(InputAdornment_1.default, { position: "end", className: styles.sendButton },
99
+ react_1.default.createElement(SmallIconButton_1.SmallIconButton, { icon: Send_1.default, disabled: comment.length === 0, onClick: sendComment, "data-reltio-id": "send-button" })), classes: { root: styles.filledInputRoot }, placeholder: ui_i18n_1.default.text('Write a comment'), value: comment, onKeyPress: onKeyPressHandler, onChange: onChange, disableUnderline: true, multiline: true })),
88
100
  react_1.default.createElement("div", { className: styles.modeSwitcherWrapper },
89
101
  BUTTONS_GROUP.length === 1 && (react_1.default.createElement(Button_1.default, { variant: "outlined", onClick: BUTTONS_GROUP[0].onClick, disabled: actionRequestIsInProgress }, BUTTONS_GROUP[0].label)),
90
102
  BUTTONS_GROUP.length > 1 && (react_1.default.createElement(ModeSwitcherSelect_1.ModeSwitcherSelect, { buttonsGroup: BUTTONS_GROUP, value: currentAction, disabled: actionRequestIsInProgress })))));
@@ -1,4 +1,4 @@
1
1
  export declare const useCommentStyles: (props?: any) => import("@mui/styles").ClassNameMap<"date" | "icon" | "comment" | "text" | "info" | "avatar" | "firstLine" | "author">;
2
2
  export declare const useCollapsedCommentsStyles: (props?: any) => import("@mui/styles").ClassNameMap<"delimiter" | "circleButton">;
3
- export declare const useWorkflowStyles: (props?: any) => import("@mui/styles").ClassNameMap<"title" | "container" | "commentsContainer" | "filledInputRoot" | "modeSwitcherWrapper">;
3
+ export declare const useWorkflowStyles: (props?: any) => import("@mui/styles").ClassNameMap<"title" | "container" | "commentsContainer" | "filledInputRoot" | "modeSwitcherWrapper" | "sendButton">;
4
4
  export declare const useExpandedComments: (props?: any) => import("@mui/styles").ClassNameMap<"messageContainer">;
@@ -90,7 +90,7 @@ exports.useWorkflowStyles = (0, styles_1.makeStyles)(function (_theme) { return
90
90
  },
91
91
  filledInputRoot: {
92
92
  backgroundColor: 'rgba(0, 0, 0, 0.03)',
93
- padding: '0 6px',
93
+ padding: '10px 6px',
94
94
  minHeight: '40px',
95
95
  margin: '10px 17px 0 6px',
96
96
  fontSize: '14px',
@@ -105,6 +105,10 @@ exports.useWorkflowStyles = (0, styles_1.makeStyles)(function (_theme) { return
105
105
  marginLeft: 'auto',
106
106
  marginRight: '16px',
107
107
  marginTop: '8px'
108
+ },
109
+ sendButton: {
110
+ alignSelf: 'end',
111
+ marginBottom: '10px'
108
112
  }
109
113
  }); });
110
114
  exports.useExpandedComments = (0, styles_1.makeStyles)(function (_theme) { return ({
@@ -8,7 +8,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
8
8
  return to.concat(ar || Array.prototype.slice.call(from));
9
9
  };
10
10
  import React, { useCallback, useState, useMemo } from 'react';
11
- import { allPass, pipe, propEq, when, always } from 'ramda';
11
+ import { pipe } from 'ramda';
12
12
  import Input from '@mui/material/Input';
13
13
  import InputAdornment from '@mui/material/InputAdornment';
14
14
  import SendIcon from '@mui/icons-material/Send';
@@ -37,6 +37,18 @@ export var WorkflowComments = function (_a) {
37
37
  setComment('');
38
38
  }, [comment, writeComment]);
39
39
  var onChange = pipe(getValue, setComment);
40
+ var onKeyPressHandler = function (e) {
41
+ if (e.key === 'Enter') {
42
+ if (comment.length > 0 && !e.shiftKey) {
43
+ e.preventDefault();
44
+ sendComment();
45
+ }
46
+ if (comment.length > 0 && e.shiftKey) {
47
+ return;
48
+ }
49
+ e.preventDefault();
50
+ }
51
+ };
40
52
  var BUTTONS_GROUP = useMemo(function () { return __spreadArray([], actions.map(function (_a) {
41
53
  var text = _a.text, onClick = _a.onClick;
42
54
  return ({
@@ -54,8 +66,8 @@ export var WorkflowComments = function (_a) {
54
66
  i18n.text('Comments'),
55
67
  " "),
56
68
  React.createElement("div", { className: styles.commentsContainer }, expanded || comments.length < 3 ? (React.createElement(ExpandedComments, { comments: comments })) : (React.createElement(CollapsedComments, { onClick: function () { return setExpanded(true); }, comments: comments }))),
57
- !readOnly && (React.createElement(Input, { endAdornment: React.createElement(InputAdornment, { position: "end" },
58
- React.createElement(SmallIconButton, { icon: SendIcon, disabled: comment.length === 0, onClick: sendComment, "data-reltio-id": "send-button" })), classes: { root: styles.filledInputRoot }, placeholder: i18n.text('Write a comment'), value: comment, onKeyPress: when(allPass([propEq('key', 'Enter'), always(comment.length > 0), propEq('shiftKey', false)]), sendComment), onChange: onChange, disableUnderline: true, multiline: true })),
69
+ !readOnly && (React.createElement(Input, { endAdornment: React.createElement(InputAdornment, { position: "end", className: styles.sendButton },
70
+ React.createElement(SmallIconButton, { icon: SendIcon, disabled: comment.length === 0, onClick: sendComment, "data-reltio-id": "send-button" })), classes: { root: styles.filledInputRoot }, placeholder: i18n.text('Write a comment'), value: comment, onKeyPress: onKeyPressHandler, onChange: onChange, disableUnderline: true, multiline: true })),
59
71
  React.createElement("div", { className: styles.modeSwitcherWrapper },
60
72
  BUTTONS_GROUP.length === 1 && (React.createElement(Button, { variant: "outlined", onClick: BUTTONS_GROUP[0].onClick, disabled: actionRequestIsInProgress }, BUTTONS_GROUP[0].label)),
61
73
  BUTTONS_GROUP.length > 1 && (React.createElement(ModeSwitcherSelect, { buttonsGroup: BUTTONS_GROUP, value: currentAction, disabled: actionRequestIsInProgress })))));
@@ -1,4 +1,4 @@
1
1
  export declare const useCommentStyles: (props?: any) => import("@mui/styles").ClassNameMap<"date" | "icon" | "comment" | "text" | "info" | "avatar" | "firstLine" | "author">;
2
2
  export declare const useCollapsedCommentsStyles: (props?: any) => import("@mui/styles").ClassNameMap<"delimiter" | "circleButton">;
3
- export declare const useWorkflowStyles: (props?: any) => import("@mui/styles").ClassNameMap<"title" | "container" | "commentsContainer" | "filledInputRoot" | "modeSwitcherWrapper">;
3
+ export declare const useWorkflowStyles: (props?: any) => import("@mui/styles").ClassNameMap<"title" | "container" | "commentsContainer" | "filledInputRoot" | "modeSwitcherWrapper" | "sendButton">;
4
4
  export declare const useExpandedComments: (props?: any) => import("@mui/styles").ClassNameMap<"messageContainer">;
@@ -87,7 +87,7 @@ export var useWorkflowStyles = makeStyles(function (_theme) { return ({
87
87
  },
88
88
  filledInputRoot: {
89
89
  backgroundColor: 'rgba(0, 0, 0, 0.03)',
90
- padding: '0 6px',
90
+ padding: '10px 6px',
91
91
  minHeight: '40px',
92
92
  margin: '10px 17px 0 6px',
93
93
  fontSize: '14px',
@@ -102,6 +102,10 @@ export var useWorkflowStyles = makeStyles(function (_theme) { return ({
102
102
  marginLeft: 'auto',
103
103
  marginRight: '16px',
104
104
  marginTop: '8px'
105
+ },
106
+ sendButton: {
107
+ alignSelf: 'end',
108
+ marginBottom: '10px'
105
109
  }
106
110
  }); });
107
111
  export var useExpandedComments = makeStyles(function (_theme) { return ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1655",
3
+ "version": "1.4.1656",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -8,7 +8,7 @@
8
8
  "@date-io/moment": "^1.3.5",
9
9
  "@fluentui/react-context-selector": "^9.1.26",
10
10
  "@react-google-maps/api": "2.7.0",
11
- "@reltio/mdm-sdk": "^1.4.1655",
11
+ "@reltio/mdm-sdk": "^1.4.1656",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",