@reltio/components 1.4.1715 → 1.4.1716-hf2

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 (27) hide show
  1. package/cjs/components/ReltioGridLayout/ReltioGridLayout.d.ts +1 -2
  2. package/cjs/components/ReltioGridLayout/ReltioGridLayout.js +5 -5
  3. package/cjs/components/editors/TypeaheadEditor/TypeaheadEditor.js +1 -1
  4. package/cjs/components/workflow/components/TaskActionButtons/TaskActionButtons.js +1 -1
  5. package/cjs/components/workflow/components/WorkflowComments/CollapsedComments.d.ts +16 -8
  6. package/cjs/components/workflow/components/WorkflowComments/CollapsedComments.js +10 -0
  7. package/cjs/components/workflow/components/WorkflowComments/Comment.d.ts +20 -9
  8. package/cjs/components/workflow/components/WorkflowComments/Comment.js +14 -3
  9. package/cjs/components/workflow/components/WorkflowComments/ExpandedComments.d.ts +14 -7
  10. package/cjs/components/workflow/components/WorkflowComments/ExpandedComments.js +11 -2
  11. package/cjs/components/workflow/components/WorkflowComments/WorkflowComments.d.ts +1 -1
  12. package/cjs/components/workflow/components/WorkflowComments/WorkflowComments.js +28 -21
  13. package/cjs/components/workflow/components/WorkflowComments/index.d.ts +1 -1
  14. package/esm/components/ReltioGridLayout/ReltioGridLayout.d.ts +1 -2
  15. package/esm/components/ReltioGridLayout/ReltioGridLayout.js +5 -5
  16. package/esm/components/editors/TypeaheadEditor/TypeaheadEditor.js +1 -1
  17. package/esm/components/workflow/components/TaskActionButtons/TaskActionButtons.js +1 -1
  18. package/esm/components/workflow/components/WorkflowComments/CollapsedComments.d.ts +16 -8
  19. package/esm/components/workflow/components/WorkflowComments/CollapsedComments.js +10 -0
  20. package/esm/components/workflow/components/WorkflowComments/Comment.d.ts +20 -9
  21. package/esm/components/workflow/components/WorkflowComments/Comment.js +14 -3
  22. package/esm/components/workflow/components/WorkflowComments/ExpandedComments.d.ts +14 -7
  23. package/esm/components/workflow/components/WorkflowComments/ExpandedComments.js +11 -2
  24. package/esm/components/workflow/components/WorkflowComments/WorkflowComments.d.ts +1 -1
  25. package/esm/components/workflow/components/WorkflowComments/WorkflowComments.js +28 -21
  26. package/esm/components/workflow/components/WorkflowComments/index.d.ts +1 -1
  27. package/package.json +2 -2
@@ -17,10 +17,9 @@ type Props<ViewConfig = Record<string, unknown>> = {
17
17
  root?: string;
18
18
  item?: string;
19
19
  };
20
- onResize?: (layout: ReactGridLayoutItem[], oldLayoutItem: ReactGridLayoutItem, layoutItem: ReactGridLayoutItem, placeholder: ReactGridLayoutItem) => void;
21
20
  };
22
21
  declare const _default: React.MemoExoticComponent<{
23
- ({ views, layout, layoutOptions, onLayoutChanged, draggableHandle, LayoutItem, onRemove, onDrop, droppingItem, isDroppable, isStatic, classes, onResize }: Props<Record<string, unknown>>): JSX.Element;
22
+ ({ views, layout, layoutOptions, onLayoutChanged, draggableHandle, LayoutItem, onRemove, onDrop, droppingItem, isDroppable, isStatic, classes }: Props<Record<string, unknown>>): JSX.Element;
24
23
  displayName: string;
25
24
  }>;
26
25
  export default _default;
@@ -52,13 +52,13 @@ var DEFAULT_LAYOUT_OPTIONS = {
52
52
  };
53
53
  var ReltioGridLayout = function (_a) {
54
54
  var _b;
55
- var views = _a.views, layout = _a.layout, _c = _a.layoutOptions, layoutOptions = _c === void 0 ? DEFAULT_LAYOUT_OPTIONS : _c, _d = _a.onLayoutChanged, onLayoutChanged = _d === void 0 ? core_1.noop : _d, draggableHandle = _a.draggableHandle, LayoutItem = _a.LayoutItem, onRemove = _a.onRemove, onDrop = _a.onDrop, droppingItem = _a.droppingItem, isDroppable = _a.isDroppable, isStatic = _a.isStatic, classes = _a.classes, _e = _a.onResize, onResize = _e === void 0 ? core_1.noop : _e;
55
+ var views = _a.views, layout = _a.layout, _c = _a.layoutOptions, layoutOptions = _c === void 0 ? DEFAULT_LAYOUT_OPTIONS : _c, _d = _a.onLayoutChanged, onLayoutChanged = _d === void 0 ? core_1.noop : _d, draggableHandle = _a.draggableHandle, LayoutItem = _a.LayoutItem, onRemove = _a.onRemove, onDrop = _a.onDrop, droppingItem = _a.droppingItem, isDroppable = _a.isDroppable, isStatic = _a.isStatic, classes = _a.classes;
56
56
  var ref = (0, react_1.useRef)();
57
57
  var heightsMap = (0, react_1.useRef)({});
58
58
  var styles = (0, styles_1.useStyles)();
59
- var _f = (0, react_1.useState)(null), resizingItemId = _f[0], setResizingItemId = _f[1];
60
- var _g = (0, react_1.useState)(null), fullscreenItemId = _g[0], setFullscreenItemId = _g[1];
61
- var _h = (0, react_1.useState)(0), width = _h[0], setWidth = _h[1];
59
+ var _e = (0, react_1.useState)(null), resizingItemId = _e[0], setResizingItemId = _e[1];
60
+ var _f = (0, react_1.useState)(null), fullscreenItemId = _f[0], setFullscreenItemId = _f[1];
61
+ var _g = (0, react_1.useState)(0), width = _g[0], setWidth = _g[1];
62
62
  var cols = layoutOptions.cols, rowHeight = layoutOptions.rowHeight, margin = layoutOptions.margin;
63
63
  var processedLayout = (0, react_1.useMemo)(function () { return (0, helpers_1.reltioLayoutToReactGridLayout)(layout); }, [layout]);
64
64
  var onReltioLayoutChanged = (0, ramda_1.pipe)(helpers_1.reactGridLayoutToReltioLayout, (0, helpers_1.copyPropsFromPreviousLayout)(['autosizing'], layout), (0, ramda_1.ifElse)((0, ramda_1.always)(isStatic), (0, helpers_1.alignGroupedItemsHeights)(heightsMap.current), (0, helpers_1.calcLayoutItemsHeight)(heightsMap.current)), onLayoutChanged);
@@ -82,7 +82,7 @@ var ReltioGridLayout = function (_a) {
82
82
  react_1.default.createElement(react_resize_detector_1.default, { refreshMode: "debounce", refreshRate: 50, handleWidth: true, onResize: function (width) { return setWidth(width); } }),
83
83
  !!width && (react_1.default.createElement(react_grid_layout_1.default, { innerRef: ref, layout: processedLayout, cols: cols, draggableHandle: draggableHandle, autoSize: true, rowHeight: rowHeight, width: width, margin: margin, onLayoutChange: isStatic ? undefined : onReltioLayoutChanged, isResizable: !isStatic && !isFullscreenEnabled, isDraggable: !isStatic && !isFullscreenEnabled, className: (0, classnames_1.default)(classes === null || classes === void 0 ? void 0 : classes.root, styles.gridLayout, (_b = {},
84
84
  _b[styles.gridFullscreen] = isFullscreenEnabled,
85
- _b)), onDrop: handleDrop, droppingItem: droppingItem, isDroppable: !isStatic && isDroppable, onResizeStart: function (_, layoutItem) { return setResizingItemId(layoutItem.i); }, onResizeStop: function () { return setResizingItemId(null); }, onResize: onResize, "data-reltio-id": "reltio-grid-layout" }, processedLayout.map(function (layoutItem) {
85
+ _b)), onDrop: handleDrop, droppingItem: droppingItem, isDroppable: !isStatic && isDroppable, onResizeStart: function (_, layoutItem) { return setResizingItemId(layoutItem.i); }, onResizeStop: function () { return setResizingItemId(null); }, "data-reltio-id": "reltio-grid-layout" }, processedLayout.map(function (layoutItem) {
86
86
  var _a;
87
87
  var isItemFullscreen = fullscreenItemId === layoutItem.i;
88
88
  var isResizing = resizingItemId === layoutItem.i;
@@ -231,7 +231,7 @@ var TypeaheadEditor = function (_a) {
231
231
  (0, hooks_1.useDidUpdateEffect)(function () {
232
232
  setPageNumber(1);
233
233
  }, [inputValue]);
234
- return (react_1.default.createElement(react_autosuggest_1.default, { key: multiple, suggestions: displayedSuggestions, shouldRenderSuggestions: ramda_1.T, getSuggestionValue: ramda_1.identity, onSuggestionsFetchRequested: handleSuggestionsFetchRequested, onSuggestionsClearRequested: handleSuggestionsClearRequested, onSuggestionHighlighted: handleSuggestionHighlighted, theme: {
234
+ return (react_1.default.createElement(react_autosuggest_1.default, { suggestions: displayedSuggestions, shouldRenderSuggestions: ramda_1.T, getSuggestionValue: ramda_1.identity, onSuggestionsFetchRequested: handleSuggestionsFetchRequested, onSuggestionsClearRequested: handleSuggestionsClearRequested, onSuggestionHighlighted: handleSuggestionHighlighted, theme: {
235
235
  container: fullWidth ? styles.suggestionsContainer : '',
236
236
  suggestionsList: styles.suggestionsList,
237
237
  suggestionsContainerOpen: styles.suggestionsContainerOpen
@@ -17,7 +17,7 @@ var TaskActionButtons = function (_a) {
17
17
  assignee: assignee,
18
18
  isOpen: isOpen
19
19
  }), actions = _b.actions, disabled = _b.actionRequestIsInProgress;
20
- var _c = (0, ramda_1.partition)((0, ramda_1.propEq)('text', preferredAction === null || preferredAction === void 0 ? void 0 : preferredAction.label), actions), preferredActions = _c[0], otherActions = _c[1];
20
+ var _c = (0, ramda_1.partition)((0, ramda_1.propEq)('text', preferredAction.label), actions), preferredActions = _c[0], otherActions = _c[1];
21
21
  return (react_1.default.createElement(react_1.default.Fragment, null,
22
22
  otherActions.map(function (action) { return (react_1.default.createElement(Button_1.default, { variant: "outlined", onClick: action.onClick, key: action.text, disabled: disabled }, action.text)); }),
23
23
  preferredActions.map(function (action) { return (react_1.default.createElement(Button_1.default, { variant: "contained", color: "primary", onClick: action.onClick, key: action.text, disabled: disabled }, action.text)); })));
@@ -1,8 +1,16 @@
1
- import React from 'react';
2
- import { WorkflowComment } from '@reltio/mdm-sdk';
3
- type Props = {
4
- comments: WorkflowComment[];
5
- onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
6
- };
7
- export declare const CollapsedComments: ({ comments, onClick }: Props) => JSX.Element;
8
- export {};
1
+ export function CollapsedComments({ comments, onClick }: {
2
+ comments: any;
3
+ onClick: any;
4
+ }): JSX.Element;
5
+ export namespace CollapsedComments {
6
+ namespace propTypes {
7
+ const comments: PropTypes.Requireable<PropTypes.InferProps<{
8
+ author: PropTypes.Requireable<string>;
9
+ id: PropTypes.Requireable<string>;
10
+ message: PropTypes.Requireable<string>;
11
+ time: PropTypes.Requireable<number>;
12
+ }>[]>;
13
+ const onClick: PropTypes.Requireable<(...args: any[]) => any>;
14
+ }
15
+ }
16
+ import PropTypes from 'prop-types';
@@ -16,6 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.CollapsedComments = void 0;
18
18
  var react_1 = __importDefault(require("react"));
19
+ var prop_types_1 = __importDefault(require("prop-types"));
19
20
  var IconButton_1 = __importDefault(require("@mui/material/IconButton"));
20
21
  var Comment_1 = require("./Comment");
21
22
  var styles_1 = require("./styles");
@@ -29,3 +30,12 @@ var CollapsedComments = function (_a) {
29
30
  react_1.default.createElement(Comment_1.Comment, __assign({}, comments[comments.length - 1]))));
30
31
  };
31
32
  exports.CollapsedComments = CollapsedComments;
33
+ exports.CollapsedComments.propTypes = {
34
+ comments: prop_types_1.default.arrayOf(prop_types_1.default.shape({
35
+ author: prop_types_1.default.string,
36
+ id: prop_types_1.default.string,
37
+ message: prop_types_1.default.string,
38
+ time: prop_types_1.default.number
39
+ })),
40
+ onClick: prop_types_1.default.func
41
+ };
@@ -1,9 +1,20 @@
1
- /// <reference types="react" />
2
- import { WorkflowComment } from '@reltio/mdm-sdk';
3
- type Props = Pick<WorkflowComment, 'author' | 'message' | 'time'> & {
4
- classes?: {
5
- messageContainer?: string;
6
- };
7
- };
8
- export declare const Comment: ({ author, message, time, classes }: Props) => JSX.Element;
9
- export {};
1
+ export function Comment({ author, classes, message, time }: {
2
+ author: any;
3
+ classes: any;
4
+ message: any;
5
+ time: any;
6
+ }): JSX.Element;
7
+ export namespace Comment {
8
+ namespace defaultProps {
9
+ const classes: {};
10
+ }
11
+ namespace propTypes {
12
+ const classes_1: PropTypes.Requireable<object>;
13
+ export { classes_1 as classes };
14
+ export const author: PropTypes.Requireable<string>;
15
+ export const id: PropTypes.Requireable<string>;
16
+ export const message: PropTypes.Requireable<string>;
17
+ export const time: PropTypes.Requireable<number>;
18
+ }
19
+ }
20
+ import PropTypes from 'prop-types';
@@ -5,13 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Comment = void 0;
7
7
  var react_1 = __importDefault(require("react"));
8
- var ui_i18n_1 = __importDefault(require("ui-i18n"));
9
- var classnames_1 = __importDefault(require("classnames"));
8
+ var prop_types_1 = __importDefault(require("prop-types"));
10
9
  var Avatar_1 = __importDefault(require("@mui/material/Avatar"));
11
10
  var Person_1 = __importDefault(require("@mui/icons-material/Person"));
11
+ var ui_i18n_1 = __importDefault(require("ui-i18n"));
12
+ var classnames_1 = __importDefault(require("classnames"));
12
13
  var styles_1 = require("./styles");
13
14
  var Comment = function (_a) {
14
- var author = _a.author, message = _a.message, time = _a.time, _b = _a.classes, classes = _b === void 0 ? {} : _b;
15
+ var author = _a.author, classes = _a.classes, message = _a.message, time = _a.time;
15
16
  var styles = (0, styles_1.useCommentStyles)();
16
17
  return (react_1.default.createElement("div", { className: styles.comment },
17
18
  react_1.default.createElement(Avatar_1.default, { className: styles.avatar },
@@ -23,3 +24,13 @@ var Comment = function (_a) {
23
24
  react_1.default.createElement("div", { className: styles.text }, message))));
24
25
  };
25
26
  exports.Comment = Comment;
27
+ exports.Comment.defaultProps = {
28
+ classes: {}
29
+ };
30
+ exports.Comment.propTypes = {
31
+ classes: prop_types_1.default.object,
32
+ author: prop_types_1.default.string,
33
+ id: prop_types_1.default.string,
34
+ message: prop_types_1.default.string,
35
+ time: prop_types_1.default.number
36
+ };
@@ -1,7 +1,14 @@
1
- /// <reference types="react" />
2
- import { WorkflowComment } from '@reltio/mdm-sdk';
3
- type Props = {
4
- comments: WorkflowComment[];
5
- };
6
- export declare const ExpandedComments: ({ comments }: Props) => JSX.Element;
7
- export {};
1
+ export function ExpandedComments({ comments }: {
2
+ comments: any;
3
+ }): any;
4
+ export namespace ExpandedComments {
5
+ namespace propTypes {
6
+ const comments: PropTypes.Requireable<PropTypes.InferProps<{
7
+ author: PropTypes.Requireable<string>;
8
+ id: PropTypes.Requireable<string>;
9
+ message: PropTypes.Requireable<string>;
10
+ time: PropTypes.Requireable<number>;
11
+ }>[]>;
12
+ }
13
+ }
14
+ import PropTypes from 'prop-types';
@@ -5,14 +5,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ExpandedComments = void 0;
7
7
  var react_1 = __importDefault(require("react"));
8
+ var prop_types_1 = __importDefault(require("prop-types"));
8
9
  var Comment_1 = require("./Comment");
9
10
  var styles_1 = require("./styles");
10
11
  var ExpandedComments = function (_a) {
11
12
  var comments = _a.comments;
12
13
  var styles = (0, styles_1.useExpandedComments)();
13
- return (react_1.default.createElement(react_1.default.Fragment, null, comments.map(function (_a) {
14
+ return comments.map(function (_a) {
14
15
  var author = _a.author, id = _a.id, message = _a.message, time = _a.time;
15
16
  return (react_1.default.createElement(Comment_1.Comment, { classes: { messageContainer: styles.messageContainer }, key: id, author: author, message: message, time: time }));
16
- })));
17
+ });
17
18
  };
18
19
  exports.ExpandedComments = ExpandedComments;
20
+ exports.ExpandedComments.propTypes = {
21
+ comments: prop_types_1.default.arrayOf(prop_types_1.default.shape({
22
+ author: prop_types_1.default.string,
23
+ id: prop_types_1.default.string,
24
+ message: prop_types_1.default.string,
25
+ time: prop_types_1.default.number
26
+ }))
27
+ };
@@ -7,7 +7,7 @@ type Props = {
7
7
  processInstanceComments: WorkflowComment[];
8
8
  taskId: string;
9
9
  isTaskOpen: boolean;
10
- preferredAction?: WorkflowAction;
10
+ preferredAction: WorkflowAction;
11
11
  };
12
12
  export declare const WorkflowComments: ({ workflowActions: actions, actionRequestIsInProgress, processInstanceComments, taskId, isTaskOpen, preferredAction }: Props) => JSX.Element;
13
13
  export {};
@@ -22,12 +22,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
26
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
27
+ if (ar || !(i in from)) {
28
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
29
+ ar[i] = from[i];
30
+ }
31
+ }
32
+ return to.concat(ar || Array.prototype.slice.call(from));
33
+ };
25
34
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
36
  };
28
37
  Object.defineProperty(exports, "__esModule", { value: true });
29
38
  exports.WorkflowComments = void 0;
30
39
  var react_1 = __importStar(require("react"));
40
+ var ramda_1 = require("ramda");
31
41
  var Input_1 = __importDefault(require("@mui/material/Input"));
32
42
  var InputAdornment_1 = __importDefault(require("@mui/material/InputAdornment"));
33
43
  var Send_1 = __importDefault(require("@mui/icons-material/Send"));
@@ -39,12 +49,13 @@ var styles_1 = require("./styles");
39
49
  var useWorkflowComments_1 = require("../../hooks/useWorkflowComments");
40
50
  var SmallIconButton_1 = require("../../../SmallIconButton");
41
51
  var ModeSwitcherSelect_1 = require("../../../ModeSwitcherSelect/ModeSwitcherSelect");
52
+ var getValue = function (e) { return e.target.value; };
42
53
  var WorkflowComments = function (_a) {
43
54
  var actions = _a.workflowActions, actionRequestIsInProgress = _a.actionRequestIsInProgress, processInstanceComments = _a.processInstanceComments, taskId = _a.taskId, isTaskOpen = _a.isTaskOpen, preferredAction = _a.preferredAction;
44
55
  var styles = (0, styles_1.useWorkflowStyles)();
45
56
  var _b = (0, react_1.useState)(false), expanded = _b[0], setExpanded = _b[1];
46
57
  var _c = (0, react_1.useState)(''), comment = _c[0], setComment = _c[1];
47
- var _d = (0, react_1.useState)(function () { var _a; return (preferredAction === null || preferredAction === void 0 ? void 0 : preferredAction.label) || ((_a = actions[0]) === null || _a === void 0 ? void 0 : _a.text); }), currentAction = _d[0], setCurrentAction = _d[1];
58
+ var _d = (0, react_1.useState)(preferredAction.label), currentAction = _d[0], setCurrentAction = _d[1];
48
59
  var _e = (0, useWorkflowComments_1.useWorkflowComments)({
49
60
  processInstanceComments: processInstanceComments,
50
61
  taskId: taskId,
@@ -54,10 +65,8 @@ var WorkflowComments = function (_a) {
54
65
  writeComment(comment);
55
66
  setComment('');
56
67
  }, [comment, writeComment]);
57
- var handleChange = (0, react_1.useCallback)(function (event) {
58
- setComment(event.target.value);
59
- }, []);
60
- var handleKeyPress = (0, react_1.useCallback)(function (e) {
68
+ var onChange = (0, ramda_1.pipe)(getValue, setComment);
69
+ var onKeyPressHandler = function (e) {
61
70
  if (e.key === 'Enter') {
62
71
  if (comment.length > 0 && !e.shiftKey) {
63
72
  e.preventDefault();
@@ -68,20 +77,18 @@ var WorkflowComments = function (_a) {
68
77
  }
69
78
  e.preventDefault();
70
79
  }
71
- }, [comment, sendComment]);
72
- var buttonsGroup = (0, react_1.useMemo)(function () {
73
- return actions.map(function (_a) {
74
- var text = _a.text, onClick = _a.onClick;
75
- return ({
76
- label: text,
77
- onClick: function () {
78
- setCurrentAction(text);
79
- onClick(comment);
80
- },
81
- value: text
82
- });
80
+ };
81
+ var BUTTONS_GROUP = (0, react_1.useMemo)(function () { return __spreadArray([], actions.map(function (_a) {
82
+ var text = _a.text, onClick = _a.onClick;
83
+ return ({
84
+ label: text,
85
+ onClick: function () {
86
+ setCurrentAction(text);
87
+ onClick(comment);
88
+ },
89
+ value: text
83
90
  });
84
- }, [actions, comment]);
91
+ }), true); }, [actions, comment]);
85
92
  return (react_1.default.createElement("div", { className: styles.container },
86
93
  react_1.default.createElement("div", { className: styles.title },
87
94
  " ",
@@ -89,9 +96,9 @@ var WorkflowComments = function (_a) {
89
96
  " "),
90
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 }))),
91
98
  !readOnly && (react_1.default.createElement(Input_1.default, { endAdornment: react_1.default.createElement(InputAdornment_1.default, { position: "end", className: styles.sendButton },
92
- 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: handleKeyPress, onChange: handleChange, disableUnderline: true, multiline: true })),
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 })),
93
100
  react_1.default.createElement("div", { className: styles.modeSwitcherWrapper },
94
- buttonsGroup.length === 1 && (react_1.default.createElement(Button_1.default, { variant: "outlined", onClick: buttonsGroup[0].onClick, disabled: actionRequestIsInProgress }, buttonsGroup[0].label)),
95
- buttonsGroup.length > 1 && (react_1.default.createElement(ModeSwitcherSelect_1.ModeSwitcherSelect, { buttonsGroup: buttonsGroup, value: currentAction, disabled: actionRequestIsInProgress })))));
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)),
102
+ BUTTONS_GROUP.length > 1 && (react_1.default.createElement(ModeSwitcherSelect_1.ModeSwitcherSelect, { buttonsGroup: BUTTONS_GROUP, value: currentAction, disabled: actionRequestIsInProgress })))));
96
103
  };
97
104
  exports.WorkflowComments = WorkflowComments;
@@ -1 +1 @@
1
- export { WorkflowComments as default } from './WorkflowComments';
1
+ export { WorkflowComments as default } from "./WorkflowComments";
@@ -17,10 +17,9 @@ type Props<ViewConfig = Record<string, unknown>> = {
17
17
  root?: string;
18
18
  item?: string;
19
19
  };
20
- onResize?: (layout: ReactGridLayoutItem[], oldLayoutItem: ReactGridLayoutItem, layoutItem: ReactGridLayoutItem, placeholder: ReactGridLayoutItem) => void;
21
20
  };
22
21
  declare const _default: React.MemoExoticComponent<{
23
- ({ views, layout, layoutOptions, onLayoutChanged, draggableHandle, LayoutItem, onRemove, onDrop, droppingItem, isDroppable, isStatic, classes, onResize }: Props<Record<string, unknown>>): JSX.Element;
22
+ ({ views, layout, layoutOptions, onLayoutChanged, draggableHandle, LayoutItem, onRemove, onDrop, droppingItem, isDroppable, isStatic, classes }: Props<Record<string, unknown>>): JSX.Element;
24
23
  displayName: string;
25
24
  }>;
26
25
  export default _default;
@@ -24,13 +24,13 @@ var DEFAULT_LAYOUT_OPTIONS = {
24
24
  };
25
25
  var ReltioGridLayout = function (_a) {
26
26
  var _b;
27
- var views = _a.views, layout = _a.layout, _c = _a.layoutOptions, layoutOptions = _c === void 0 ? DEFAULT_LAYOUT_OPTIONS : _c, _d = _a.onLayoutChanged, onLayoutChanged = _d === void 0 ? noop : _d, draggableHandle = _a.draggableHandle, LayoutItem = _a.LayoutItem, onRemove = _a.onRemove, onDrop = _a.onDrop, droppingItem = _a.droppingItem, isDroppable = _a.isDroppable, isStatic = _a.isStatic, classes = _a.classes, _e = _a.onResize, onResize = _e === void 0 ? noop : _e;
27
+ var views = _a.views, layout = _a.layout, _c = _a.layoutOptions, layoutOptions = _c === void 0 ? DEFAULT_LAYOUT_OPTIONS : _c, _d = _a.onLayoutChanged, onLayoutChanged = _d === void 0 ? noop : _d, draggableHandle = _a.draggableHandle, LayoutItem = _a.LayoutItem, onRemove = _a.onRemove, onDrop = _a.onDrop, droppingItem = _a.droppingItem, isDroppable = _a.isDroppable, isStatic = _a.isStatic, classes = _a.classes;
28
28
  var ref = useRef();
29
29
  var heightsMap = useRef({});
30
30
  var styles = useStyles();
31
- var _f = useState(null), resizingItemId = _f[0], setResizingItemId = _f[1];
32
- var _g = useState(null), fullscreenItemId = _g[0], setFullscreenItemId = _g[1];
33
- var _h = useState(0), width = _h[0], setWidth = _h[1];
31
+ var _e = useState(null), resizingItemId = _e[0], setResizingItemId = _e[1];
32
+ var _f = useState(null), fullscreenItemId = _f[0], setFullscreenItemId = _f[1];
33
+ var _g = useState(0), width = _g[0], setWidth = _g[1];
34
34
  var cols = layoutOptions.cols, rowHeight = layoutOptions.rowHeight, margin = layoutOptions.margin;
35
35
  var processedLayout = useMemo(function () { return reltioLayoutToReactGridLayout(layout); }, [layout]);
36
36
  var onReltioLayoutChanged = pipe(reactGridLayoutToReltioLayout, copyPropsFromPreviousLayout(['autosizing'], layout), ifElse(always(isStatic), alignGroupedItemsHeights(heightsMap.current), calcLayoutItemsHeight(heightsMap.current)), onLayoutChanged);
@@ -54,7 +54,7 @@ var ReltioGridLayout = function (_a) {
54
54
  React.createElement(ReactResizeDetector, { refreshMode: "debounce", refreshRate: 50, handleWidth: true, onResize: function (width) { return setWidth(width); } }),
55
55
  !!width && (React.createElement(GridLayout, { innerRef: ref, layout: processedLayout, cols: cols, draggableHandle: draggableHandle, autoSize: true, rowHeight: rowHeight, width: width, margin: margin, onLayoutChange: isStatic ? undefined : onReltioLayoutChanged, isResizable: !isStatic && !isFullscreenEnabled, isDraggable: !isStatic && !isFullscreenEnabled, className: classnames(classes === null || classes === void 0 ? void 0 : classes.root, styles.gridLayout, (_b = {},
56
56
  _b[styles.gridFullscreen] = isFullscreenEnabled,
57
- _b)), onDrop: handleDrop, droppingItem: droppingItem, isDroppable: !isStatic && isDroppable, onResizeStart: function (_, layoutItem) { return setResizingItemId(layoutItem.i); }, onResizeStop: function () { return setResizingItemId(null); }, onResize: onResize, "data-reltio-id": "reltio-grid-layout" }, processedLayout.map(function (layoutItem) {
57
+ _b)), onDrop: handleDrop, droppingItem: droppingItem, isDroppable: !isStatic && isDroppable, onResizeStart: function (_, layoutItem) { return setResizingItemId(layoutItem.i); }, onResizeStop: function () { return setResizingItemId(null); }, "data-reltio-id": "reltio-grid-layout" }, processedLayout.map(function (layoutItem) {
58
58
  var _a;
59
59
  var isItemFullscreen = fullscreenItemId === layoutItem.i;
60
60
  var isResizing = resizingItemId === layoutItem.i;
@@ -203,7 +203,7 @@ var TypeaheadEditor = function (_a) {
203
203
  useDidUpdateEffect(function () {
204
204
  setPageNumber(1);
205
205
  }, [inputValue]);
206
- return (React.createElement(Autosuggest, { key: multiple, suggestions: displayedSuggestions, shouldRenderSuggestions: T, getSuggestionValue: identity, onSuggestionsFetchRequested: handleSuggestionsFetchRequested, onSuggestionsClearRequested: handleSuggestionsClearRequested, onSuggestionHighlighted: handleSuggestionHighlighted, theme: {
206
+ return (React.createElement(Autosuggest, { suggestions: displayedSuggestions, shouldRenderSuggestions: T, getSuggestionValue: identity, onSuggestionsFetchRequested: handleSuggestionsFetchRequested, onSuggestionsClearRequested: handleSuggestionsClearRequested, onSuggestionHighlighted: handleSuggestionHighlighted, theme: {
207
207
  container: fullWidth ? styles.suggestionsContainer : '',
208
208
  suggestionsList: styles.suggestionsList,
209
209
  suggestionsContainerOpen: styles.suggestionsContainerOpen
@@ -11,7 +11,7 @@ export var TaskActionButtons = function (_a) {
11
11
  assignee: assignee,
12
12
  isOpen: isOpen
13
13
  }), actions = _b.actions, disabled = _b.actionRequestIsInProgress;
14
- var _c = partition(propEq('text', preferredAction === null || preferredAction === void 0 ? void 0 : preferredAction.label), actions), preferredActions = _c[0], otherActions = _c[1];
14
+ var _c = partition(propEq('text', preferredAction.label), actions), preferredActions = _c[0], otherActions = _c[1];
15
15
  return (React.createElement(React.Fragment, null,
16
16
  otherActions.map(function (action) { return (React.createElement(Button, { variant: "outlined", onClick: action.onClick, key: action.text, disabled: disabled }, action.text)); }),
17
17
  preferredActions.map(function (action) { return (React.createElement(Button, { variant: "contained", color: "primary", onClick: action.onClick, key: action.text, disabled: disabled }, action.text)); })));
@@ -1,8 +1,16 @@
1
- import React from 'react';
2
- import { WorkflowComment } from '@reltio/mdm-sdk';
3
- type Props = {
4
- comments: WorkflowComment[];
5
- onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
6
- };
7
- export declare const CollapsedComments: ({ comments, onClick }: Props) => JSX.Element;
8
- export {};
1
+ export function CollapsedComments({ comments, onClick }: {
2
+ comments: any;
3
+ onClick: any;
4
+ }): JSX.Element;
5
+ export namespace CollapsedComments {
6
+ namespace propTypes {
7
+ const comments: PropTypes.Requireable<PropTypes.InferProps<{
8
+ author: PropTypes.Requireable<string>;
9
+ id: PropTypes.Requireable<string>;
10
+ message: PropTypes.Requireable<string>;
11
+ time: PropTypes.Requireable<number>;
12
+ }>[]>;
13
+ const onClick: PropTypes.Requireable<(...args: any[]) => any>;
14
+ }
15
+ }
16
+ import PropTypes from 'prop-types';
@@ -10,6 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import React from 'react';
13
+ import PropTypes from 'prop-types';
13
14
  import IconButton from '@mui/material/IconButton';
14
15
  import { Comment } from './Comment';
15
16
  import { useCollapsedCommentsStyles } from './styles';
@@ -22,3 +23,12 @@ export var CollapsedComments = function (_a) {
22
23
  React.createElement(IconButton, { className: styles.circleButton, onClick: onClick, size: "large" }, comments.length - 2)),
23
24
  React.createElement(Comment, __assign({}, comments[comments.length - 1]))));
24
25
  };
26
+ CollapsedComments.propTypes = {
27
+ comments: PropTypes.arrayOf(PropTypes.shape({
28
+ author: PropTypes.string,
29
+ id: PropTypes.string,
30
+ message: PropTypes.string,
31
+ time: PropTypes.number
32
+ })),
33
+ onClick: PropTypes.func
34
+ };
@@ -1,9 +1,20 @@
1
- /// <reference types="react" />
2
- import { WorkflowComment } from '@reltio/mdm-sdk';
3
- type Props = Pick<WorkflowComment, 'author' | 'message' | 'time'> & {
4
- classes?: {
5
- messageContainer?: string;
6
- };
7
- };
8
- export declare const Comment: ({ author, message, time, classes }: Props) => JSX.Element;
9
- export {};
1
+ export function Comment({ author, classes, message, time }: {
2
+ author: any;
3
+ classes: any;
4
+ message: any;
5
+ time: any;
6
+ }): JSX.Element;
7
+ export namespace Comment {
8
+ namespace defaultProps {
9
+ const classes: {};
10
+ }
11
+ namespace propTypes {
12
+ const classes_1: PropTypes.Requireable<object>;
13
+ export { classes_1 as classes };
14
+ export const author: PropTypes.Requireable<string>;
15
+ export const id: PropTypes.Requireable<string>;
16
+ export const message: PropTypes.Requireable<string>;
17
+ export const time: PropTypes.Requireable<number>;
18
+ }
19
+ }
20
+ import PropTypes from 'prop-types';
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
- import i18n from 'ui-i18n';
3
- import classnames from 'classnames';
2
+ import PropTypes from 'prop-types';
4
3
  import Avatar from '@mui/material/Avatar';
5
4
  import Person from '@mui/icons-material/Person';
5
+ import i18n from 'ui-i18n';
6
+ import classnames from 'classnames';
6
7
  import { useCommentStyles } from './styles';
7
8
  export var Comment = function (_a) {
8
- var author = _a.author, message = _a.message, time = _a.time, _b = _a.classes, classes = _b === void 0 ? {} : _b;
9
+ var author = _a.author, classes = _a.classes, message = _a.message, time = _a.time;
9
10
  var styles = useCommentStyles();
10
11
  return (React.createElement("div", { className: styles.comment },
11
12
  React.createElement(Avatar, { className: styles.avatar },
@@ -16,3 +17,13 @@ export var Comment = function (_a) {
16
17
  React.createElement("span", { className: styles.date }, i18n.date(time, 'L LT'))),
17
18
  React.createElement("div", { className: styles.text }, message))));
18
19
  };
20
+ Comment.defaultProps = {
21
+ classes: {}
22
+ };
23
+ Comment.propTypes = {
24
+ classes: PropTypes.object,
25
+ author: PropTypes.string,
26
+ id: PropTypes.string,
27
+ message: PropTypes.string,
28
+ time: PropTypes.number
29
+ };
@@ -1,7 +1,14 @@
1
- /// <reference types="react" />
2
- import { WorkflowComment } from '@reltio/mdm-sdk';
3
- type Props = {
4
- comments: WorkflowComment[];
5
- };
6
- export declare const ExpandedComments: ({ comments }: Props) => JSX.Element;
7
- export {};
1
+ export function ExpandedComments({ comments }: {
2
+ comments: any;
3
+ }): any;
4
+ export namespace ExpandedComments {
5
+ namespace propTypes {
6
+ const comments: PropTypes.Requireable<PropTypes.InferProps<{
7
+ author: PropTypes.Requireable<string>;
8
+ id: PropTypes.Requireable<string>;
9
+ message: PropTypes.Requireable<string>;
10
+ time: PropTypes.Requireable<number>;
11
+ }>[]>;
12
+ }
13
+ }
14
+ import PropTypes from 'prop-types';
@@ -1,11 +1,20 @@
1
1
  import React from 'react';
2
+ import PropTypes from 'prop-types';
2
3
  import { Comment } from './Comment';
3
4
  import { useExpandedComments } from './styles';
4
5
  export var ExpandedComments = function (_a) {
5
6
  var comments = _a.comments;
6
7
  var styles = useExpandedComments();
7
- return (React.createElement(React.Fragment, null, comments.map(function (_a) {
8
+ return comments.map(function (_a) {
8
9
  var author = _a.author, id = _a.id, message = _a.message, time = _a.time;
9
10
  return (React.createElement(Comment, { classes: { messageContainer: styles.messageContainer }, key: id, author: author, message: message, time: time }));
10
- })));
11
+ });
12
+ };
13
+ ExpandedComments.propTypes = {
14
+ comments: PropTypes.arrayOf(PropTypes.shape({
15
+ author: PropTypes.string,
16
+ id: PropTypes.string,
17
+ message: PropTypes.string,
18
+ time: PropTypes.number
19
+ }))
11
20
  };
@@ -7,7 +7,7 @@ type Props = {
7
7
  processInstanceComments: WorkflowComment[];
8
8
  taskId: string;
9
9
  isTaskOpen: boolean;
10
- preferredAction?: WorkflowAction;
10
+ preferredAction: WorkflowAction;
11
11
  };
12
12
  export declare const WorkflowComments: ({ workflowActions: actions, actionRequestIsInProgress, processInstanceComments, taskId, isTaskOpen, preferredAction }: Props) => JSX.Element;
13
13
  export {};
@@ -1,4 +1,14 @@
1
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
1
10
  import React, { useCallback, useState, useMemo } from 'react';
11
+ import { pipe } from 'ramda';
2
12
  import Input from '@mui/material/Input';
3
13
  import InputAdornment from '@mui/material/InputAdornment';
4
14
  import SendIcon from '@mui/icons-material/Send';
@@ -10,12 +20,13 @@ import { useWorkflowStyles } from './styles';
10
20
  import { useWorkflowComments } from '../../hooks/useWorkflowComments';
11
21
  import { SmallIconButton } from '../../../SmallIconButton';
12
22
  import { ModeSwitcherSelect } from '../../../ModeSwitcherSelect/ModeSwitcherSelect';
23
+ var getValue = function (e) { return e.target.value; };
13
24
  export var WorkflowComments = function (_a) {
14
25
  var actions = _a.workflowActions, actionRequestIsInProgress = _a.actionRequestIsInProgress, processInstanceComments = _a.processInstanceComments, taskId = _a.taskId, isTaskOpen = _a.isTaskOpen, preferredAction = _a.preferredAction;
15
26
  var styles = useWorkflowStyles();
16
27
  var _b = useState(false), expanded = _b[0], setExpanded = _b[1];
17
28
  var _c = useState(''), comment = _c[0], setComment = _c[1];
18
- var _d = useState(function () { var _a; return (preferredAction === null || preferredAction === void 0 ? void 0 : preferredAction.label) || ((_a = actions[0]) === null || _a === void 0 ? void 0 : _a.text); }), currentAction = _d[0], setCurrentAction = _d[1];
29
+ var _d = useState(preferredAction.label), currentAction = _d[0], setCurrentAction = _d[1];
19
30
  var _e = useWorkflowComments({
20
31
  processInstanceComments: processInstanceComments,
21
32
  taskId: taskId,
@@ -25,10 +36,8 @@ export var WorkflowComments = function (_a) {
25
36
  writeComment(comment);
26
37
  setComment('');
27
38
  }, [comment, writeComment]);
28
- var handleChange = useCallback(function (event) {
29
- setComment(event.target.value);
30
- }, []);
31
- var handleKeyPress = useCallback(function (e) {
39
+ var onChange = pipe(getValue, setComment);
40
+ var onKeyPressHandler = function (e) {
32
41
  if (e.key === 'Enter') {
33
42
  if (comment.length > 0 && !e.shiftKey) {
34
43
  e.preventDefault();
@@ -39,20 +48,18 @@ export var WorkflowComments = function (_a) {
39
48
  }
40
49
  e.preventDefault();
41
50
  }
42
- }, [comment, sendComment]);
43
- var buttonsGroup = useMemo(function () {
44
- return actions.map(function (_a) {
45
- var text = _a.text, onClick = _a.onClick;
46
- return ({
47
- label: text,
48
- onClick: function () {
49
- setCurrentAction(text);
50
- onClick(comment);
51
- },
52
- value: text
53
- });
51
+ };
52
+ var BUTTONS_GROUP = useMemo(function () { return __spreadArray([], actions.map(function (_a) {
53
+ var text = _a.text, onClick = _a.onClick;
54
+ return ({
55
+ label: text,
56
+ onClick: function () {
57
+ setCurrentAction(text);
58
+ onClick(comment);
59
+ },
60
+ value: text
54
61
  });
55
- }, [actions, comment]);
62
+ }), true); }, [actions, comment]);
56
63
  return (React.createElement("div", { className: styles.container },
57
64
  React.createElement("div", { className: styles.title },
58
65
  " ",
@@ -60,8 +67,8 @@ export var WorkflowComments = function (_a) {
60
67
  " "),
61
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 }))),
62
69
  !readOnly && (React.createElement(Input, { endAdornment: React.createElement(InputAdornment, { position: "end", className: styles.sendButton },
63
- 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: handleKeyPress, onChange: handleChange, disableUnderline: true, multiline: true })),
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 })),
64
71
  React.createElement("div", { className: styles.modeSwitcherWrapper },
65
- buttonsGroup.length === 1 && (React.createElement(Button, { variant: "outlined", onClick: buttonsGroup[0].onClick, disabled: actionRequestIsInProgress }, buttonsGroup[0].label)),
66
- buttonsGroup.length > 1 && (React.createElement(ModeSwitcherSelect, { buttonsGroup: buttonsGroup, value: currentAction, disabled: actionRequestIsInProgress })))));
72
+ BUTTONS_GROUP.length === 1 && (React.createElement(Button, { variant: "outlined", onClick: BUTTONS_GROUP[0].onClick, disabled: actionRequestIsInProgress }, BUTTONS_GROUP[0].label)),
73
+ BUTTONS_GROUP.length > 1 && (React.createElement(ModeSwitcherSelect, { buttonsGroup: BUTTONS_GROUP, value: currentAction, disabled: actionRequestIsInProgress })))));
67
74
  };
@@ -1 +1 @@
1
- export { WorkflowComments as default } from './WorkflowComments';
1
+ export { WorkflowComments as default } from "./WorkflowComments";
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1715",
3
+ "version": "1.4.1716-hf2",
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
  "@fluentui/react-context-selector": "^9.1.26",
9
9
  "@react-google-maps/api": "2.7.0",
10
- "@reltio/mdm-sdk": "^1.4.1709",
10
+ "@reltio/mdm-sdk": "^1.4.1716-hf2",
11
11
  "classnames": "^2.2.5",
12
12
  "d3-cloud": "^1.2.5",
13
13
  "d3-geo": "^2.0.1",