@reltio/components 1.4.878 → 1.4.879
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/Comment/styles.d.ts +1 -1
- package/components/DropDownSelector/DropDownSelector.d.ts +16 -15
- package/components/DropDownSelector/DropDownSelector.js +2 -1
- package/components/DropDownSelector/styles.d.ts +1 -1
- package/components/ImageDetailsView/ImageDetailsViewSidebar/styles.d.ts +1 -1
- package/components/ImageGalleryDialog/styles.d.ts +1 -1
- package/components/MatchRulesBlock/MatchRulesTooltip/styles.d.ts +1 -1
- package/components/PotentialMatchReviewCard/styles.d.ts +1 -1
- package/components/SidePanel/styles.js +1 -1
- package/components/UploadImageDialog/styles.d.ts +1 -1
- package/components/attributes/PivotingAttributes/styles.d.ts +1 -1
- package/components/editors/DateEditor/DateEditor.d.ts +4 -2
- package/components/editors/DateEditor/DateEditor.js +6 -9
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.d.ts +7 -0
- package/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +28 -0
- package/components/workflow/cards/GenericWorkflowTaskCard/GenericWorkflowTaskCard.d.ts +10 -0
- package/components/workflow/cards/GenericWorkflowTaskCard/GenericWorkflowTaskCard.js +76 -0
- package/components/workflow/cards/GenericWorkflowTaskCard/styles.d.ts +3 -0
- package/components/workflow/cards/GenericWorkflowTaskCard/styles.js +110 -0
- package/components/workflow/cards/WorkflowTaskCard.d.ts +3 -0
- package/components/workflow/cards/WorkflowTaskCard.js +5 -0
- package/components/workflow/cards/WorkflowTaskCardsFactory.d.ts +9 -0
- package/components/workflow/cards/WorkflowTaskCardsFactory.js +27 -0
- package/components/workflow/components/AssigneeSelector/AssigneeSelector.d.ts +5 -0
- package/components/workflow/components/AssigneeSelector/AssigneeSelector.js +14 -0
- package/components/workflow/components/DueDateField/DueDateField.d.ts +7 -0
- package/components/workflow/components/DueDateField/DueDateField.js +14 -0
- package/components/workflow/components/DueDateField/styles.d.ts +1 -0
- package/components/workflow/components/DueDateField/styles.js +13 -0
- package/components/workflow/components/LineDecorator/LineDecorator.d.ts +11 -0
- package/components/workflow/components/LineDecorator/LineDecorator.js +14 -0
- package/components/workflow/components/LineDecorator/styles.d.ts +1 -0
- package/components/workflow/components/LineDecorator/styles.js +59 -0
- package/components/workflow/components/PrioritySelector/PrioritySelector.d.ts +7 -0
- package/components/workflow/components/PrioritySelector/PrioritySelector.js +12 -0
- package/components/workflow/components/TaskActions/TaskActions.d.ts +5 -0
- package/components/workflow/components/TaskActions/TaskActions.js +15 -0
- package/components/workflow/components/WorkflowComments/CollapsedComments.d.ts +16 -0
- package/components/workflow/components/WorkflowComments/CollapsedComments.js +34 -0
- package/components/workflow/components/WorkflowComments/Comment.d.ts +20 -0
- package/components/workflow/components/WorkflowComments/Comment.js +29 -0
- package/components/workflow/components/WorkflowComments/ExpandedComments.d.ts +14 -0
- package/components/workflow/components/WorkflowComments/ExpandedComments.js +20 -0
- package/components/workflow/components/WorkflowComments/WorkflowComments.d.ts +16 -0
- package/components/workflow/components/WorkflowComments/WorkflowComments.js +42 -0
- package/components/workflow/components/WorkflowComments/index.d.ts +1 -0
- package/components/workflow/components/WorkflowComments/index.js +1 -0
- package/components/workflow/components/WorkflowComments/styles.d.ts +4 -0
- package/components/workflow/components/WorkflowComments/styles.js +105 -0
- package/components/workflow/helpers/errors.d.ts +2 -0
- package/components/workflow/helpers/errors.js +14 -0
- package/components/workflow/helpers/index.d.ts +3 -0
- package/components/workflow/helpers/index.js +10 -0
- package/components/workflow/hooks/useWorkflowActions.d.ts +10 -0
- package/components/workflow/hooks/useWorkflowActions.js +57 -0
- package/components/workflow/hooks/useWorkflowAssignee.d.ts +13 -0
- package/components/workflow/hooks/useWorkflowAssignee.js +83 -0
- package/components/workflow/hooks/useWorkflowCheckPermission.d.ts +1 -0
- package/components/workflow/hooks/useWorkflowCheckPermission.js +84 -0
- package/components/workflow/hooks/useWorkflowColor.d.ts +3 -0
- package/components/workflow/hooks/useWorkflowColor.js +31 -0
- package/components/workflow/hooks/useWorkflowComments.d.ts +7 -0
- package/components/workflow/hooks/useWorkflowComments.js +50 -0
- package/components/workflow/hooks/useWorkflowDueDate.d.ts +6 -0
- package/components/workflow/hooks/useWorkflowDueDate.js +39 -0
- package/components/workflow/hooks/useWorkflowPriority.d.ts +12 -0
- package/components/workflow/hooks/useWorkflowPriority.js +59 -0
- package/components/workflow/index.d.ts +5 -0
- package/components/workflow/index.js +5 -0
- package/contexts/WorkflowTasksContext/index.d.ts +9 -0
- package/contexts/WorkflowTasksContext/index.js +3 -0
- package/contexts/index.d.ts +15 -14
- package/contexts/index.js +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +1 -0
- package/hooks/useWorkflowTasks.d.ts +8 -0
- package/hooks/useWorkflowTasks.js +65 -0
- package/icons/CollaborationIcon.d.ts +3 -0
- package/icons/CollaborationIcon.js +22 -0
- package/icons/DcrTaskIcon.d.ts +3 -0
- package/icons/DcrTaskIcon.js +19 -0
- package/icons/DefaultTaskIcon.d.ts +3 -0
- package/icons/DefaultTaskIcon.js +19 -0
- package/icons/DeleteRequestTaskIcon.d.ts +3 -0
- package/icons/DeleteRequestTaskIcon.js +19 -0
- package/icons/PmTaskIcon.d.ts +3 -0
- package/icons/PmTaskIcon.js +19 -0
- package/icons/index.d.ts +11 -2
- package/icons/index.js +11 -2
- package/package.json +3 -3
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
2
|
+
var pointColor = '#d8d8d8';
|
|
3
|
+
var lineStyle = '2px solid rgba(0,0,0,0.06)';
|
|
4
|
+
var pointSize = 6;
|
|
5
|
+
var blockWidth = 56;
|
|
6
|
+
var linePadding = 10;
|
|
7
|
+
var pointPadding = 10;
|
|
8
|
+
export var useStyles = makeStyles({
|
|
9
|
+
decorator: {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
alignItems: 'stretch'
|
|
12
|
+
},
|
|
13
|
+
lineBlock: {
|
|
14
|
+
width: blockWidth + "px"
|
|
15
|
+
},
|
|
16
|
+
withLinePadding: {
|
|
17
|
+
'& $noLine': {
|
|
18
|
+
height: linePadding + "px"
|
|
19
|
+
},
|
|
20
|
+
'& $line': {
|
|
21
|
+
height: "calc(100% - " + linePadding + "px)"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
noLine: {
|
|
25
|
+
height: '0'
|
|
26
|
+
},
|
|
27
|
+
line: {
|
|
28
|
+
height: '100%',
|
|
29
|
+
position: 'relative',
|
|
30
|
+
marginLeft: '31px',
|
|
31
|
+
borderLeft: lineStyle,
|
|
32
|
+
'&:before': {
|
|
33
|
+
position: 'absolute',
|
|
34
|
+
height: pointSize,
|
|
35
|
+
width: pointSize,
|
|
36
|
+
borderRadius: '50%',
|
|
37
|
+
left: -pointSize + 1,
|
|
38
|
+
top: pointPadding + "px",
|
|
39
|
+
background: pointColor,
|
|
40
|
+
content: '""',
|
|
41
|
+
display: 'block',
|
|
42
|
+
border: '1px solid white'
|
|
43
|
+
},
|
|
44
|
+
'&$plain': {
|
|
45
|
+
'&:before': {
|
|
46
|
+
width: 0,
|
|
47
|
+
border: 'none'
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
'&$last': {
|
|
51
|
+
height: pointPadding + "px"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
content: {
|
|
55
|
+
flex: 1
|
|
56
|
+
},
|
|
57
|
+
plain: {},
|
|
58
|
+
last: {}
|
|
59
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { WorkflowTaskData } from '@reltio/mdm-sdk';
|
|
3
|
+
declare type Props = Pick<WorkflowTaskData, 'taskId' | 'priority'> & {
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const PrioritySelector: ({ taskId, priority, className }: Props) => JSX.Element;
|
|
7
|
+
export default PrioritySelector;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import i18n from 'ui-i18n';
|
|
3
|
+
import { propEq } from 'ramda';
|
|
4
|
+
import DropDownSelector from '../../../DropDownSelector/DropDownSelector';
|
|
5
|
+
import { useWorkflowPriority } from '../../hooks/useWorkflowPriority';
|
|
6
|
+
var PrioritySelector = function (_a) {
|
|
7
|
+
var taskId = _a.taskId, priority = _a.priority, className = _a.className;
|
|
8
|
+
var _b = useWorkflowPriority({ taskId: taskId, priority: priority }), priorities = _b.priorities, updatePriority = _b.updatePriority, updateRequestIsInProgress = _b.updateRequestIsInProgress, readOnly = _b.readOnly;
|
|
9
|
+
var disabled = updateRequestIsInProgress || readOnly;
|
|
10
|
+
return (React.createElement(DropDownSelector, { className: className, isDisabled: disabled, options: priorities, onChange: updatePriority, hideSelectedOptions: false, label: i18n.text('Priority'), value: priorities.find(propEq('value', priority)), TextFieldProps: { disabled: disabled }, height: 40 }));
|
|
11
|
+
};
|
|
12
|
+
export default PrioritySelector;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { WorkflowTaskData } from '@reltio/mdm-sdk';
|
|
3
|
+
declare type Props = Pick<WorkflowTaskData, 'taskId' | 'possibleActions' | 'assignee'>;
|
|
4
|
+
declare const TaskActions: ({ taskId, possibleActions, assignee }: Props) => JSX.Element;
|
|
5
|
+
export default TaskActions;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import MoreVertIcon from '@material-ui/icons/MoreVert';
|
|
3
|
+
import { useWorkflowActions } from '../../hooks/useWorkflowActions';
|
|
4
|
+
import DropDownMenuButton from '../../../DropDownMenuButton/DropDownMenuButton';
|
|
5
|
+
import SmallIconButton from '../../../SmallIconButton/SmallIconButton';
|
|
6
|
+
var TaskActions = function (_a) {
|
|
7
|
+
var taskId = _a.taskId, possibleActions = _a.possibleActions, assignee = _a.assignee;
|
|
8
|
+
var _b = useWorkflowActions({ taskId: taskId, possibleActions: possibleActions, assignee: assignee }), actions = _b.actions, disabled = _b.actionRequestIsInProgress;
|
|
9
|
+
return actions.length > 0 ? (React.createElement(DropDownMenuButton, { buttonComponent: SmallIconButton, buttonProps: {
|
|
10
|
+
icon: MoreVertIcon,
|
|
11
|
+
size: 'L',
|
|
12
|
+
disabled: disabled
|
|
13
|
+
}, menuId: 'workflow-actions', menuItems: actions })) : null;
|
|
14
|
+
};
|
|
15
|
+
export default TaskActions;
|
|
@@ -0,0 +1,16 @@
|
|
|
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";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
import IconButton from '@material-ui/core/IconButton';
|
|
15
|
+
import { Comment } from './Comment';
|
|
16
|
+
import { useCollapsedCommentsStyles } from './styles';
|
|
17
|
+
export var CollapsedComments = function (_a) {
|
|
18
|
+
var comments = _a.comments, onClick = _a.onClick;
|
|
19
|
+
var styles = useCollapsedCommentsStyles();
|
|
20
|
+
return (React.createElement(React.Fragment, null,
|
|
21
|
+
React.createElement(Comment, __assign({}, comments[0])),
|
|
22
|
+
React.createElement("div", { className: styles.delimiter },
|
|
23
|
+
React.createElement(IconButton, { className: styles.circleButton, onClick: onClick }, comments.length - 2)),
|
|
24
|
+
React.createElement(Comment, __assign({}, comments[comments.length - 1]))));
|
|
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
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
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";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Avatar from '@material-ui/core/Avatar';
|
|
4
|
+
import Person from '@material-ui/icons/Person';
|
|
5
|
+
import i18n from 'ui-i18n';
|
|
6
|
+
import classnames from 'classnames';
|
|
7
|
+
import { useCommentStyles } from './styles';
|
|
8
|
+
export var Comment = function (_a) {
|
|
9
|
+
var author = _a.author, classes = _a.classes, message = _a.message, time = _a.time;
|
|
10
|
+
var styles = useCommentStyles();
|
|
11
|
+
return (React.createElement("div", { className: styles.comment },
|
|
12
|
+
React.createElement(Avatar, { className: styles.avatar },
|
|
13
|
+
React.createElement(Person, { className: styles.icon })),
|
|
14
|
+
React.createElement("div", { className: classnames(styles.info, classes.messageContainer) },
|
|
15
|
+
React.createElement("div", { className: styles.firstLine },
|
|
16
|
+
React.createElement("div", { className: styles.author }, author),
|
|
17
|
+
React.createElement("span", { className: styles.date }, i18n.date(time, 'L LT'))),
|
|
18
|
+
React.createElement("div", { className: styles.text }, message))));
|
|
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
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
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";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Comment } from './Comment';
|
|
4
|
+
import { useExpandedComments } from './styles';
|
|
5
|
+
export var ExpandedComments = function (_a) {
|
|
6
|
+
var comments = _a.comments;
|
|
7
|
+
var styles = useExpandedComments();
|
|
8
|
+
return comments.map(function (_a) {
|
|
9
|
+
var author = _a.author, id = _a.id, message = _a.message, time = _a.time;
|
|
10
|
+
return (React.createElement(Comment, { classes: { messageContainer: styles.messageContainer }, key: id, author: author, message: message, time: time }));
|
|
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
|
+
}))
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function WorkflowComments({ processInstanceComments, taskId }: {
|
|
2
|
+
processInstanceComments: any;
|
|
3
|
+
taskId: any;
|
|
4
|
+
}): JSX.Element;
|
|
5
|
+
export namespace WorkflowComments {
|
|
6
|
+
namespace propTypes {
|
|
7
|
+
const processInstanceComments: 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 taskId: PropTypes.Requireable<string>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
import PropTypes from "prop-types";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import { pipe, propEq, when } from 'ramda';
|
|
3
|
+
import Input from '@material-ui/core/Input';
|
|
4
|
+
import InputAdornment from '@material-ui/core/InputAdornment';
|
|
5
|
+
import SendIcon from '@material-ui/icons/Send';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import i18n from 'ui-i18n';
|
|
8
|
+
import { CollapsedComments } from './CollapsedComments';
|
|
9
|
+
import { ExpandedComments } from './ExpandedComments';
|
|
10
|
+
import { useWorkflowStyles } from './styles';
|
|
11
|
+
import { useWorkflowComments } from '../../hooks/useWorkflowComments';
|
|
12
|
+
import { SmallIconButton } from '../../../SmallIconButton';
|
|
13
|
+
var getValue = function (e) { return e.target.value; };
|
|
14
|
+
export var WorkflowComments = function (_a) {
|
|
15
|
+
var processInstanceComments = _a.processInstanceComments, taskId = _a.taskId;
|
|
16
|
+
var styles = useWorkflowStyles();
|
|
17
|
+
var _b = useState(false), expanded = _b[0], setExpanded = _b[1];
|
|
18
|
+
var _c = useState(''), comment = _c[0], setComment = _c[1];
|
|
19
|
+
var _d = useWorkflowComments({ processInstanceComments: processInstanceComments, taskId: taskId }), comments = _d.comments, writeComment = _d.writeComment, readOnly = _d.readOnly;
|
|
20
|
+
var sendComment = useCallback(function () {
|
|
21
|
+
writeComment(comment);
|
|
22
|
+
setComment('');
|
|
23
|
+
}, [comment, writeComment]);
|
|
24
|
+
var onChange = pipe(getValue, setComment);
|
|
25
|
+
return (React.createElement("div", { className: styles.container },
|
|
26
|
+
React.createElement("div", { className: styles.title },
|
|
27
|
+
" ",
|
|
28
|
+
i18n.text('Comments'),
|
|
29
|
+
" "),
|
|
30
|
+
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 }))),
|
|
31
|
+
!readOnly && (React.createElement(Input, { endAdornment: React.createElement(InputAdornment, { position: "end" },
|
|
32
|
+
React.createElement(SmallIconButton, { icon: SendIcon, disabled: comment.length === 0, onClick: sendComment })), classes: { root: styles.filledInputRoot }, placeholder: i18n.text('Write a comment'), value: comment, onKeyPress: when(propEq('key', 'Enter'), sendComment), onChange: onChange, disableUnderline: true }))));
|
|
33
|
+
};
|
|
34
|
+
WorkflowComments.propTypes = {
|
|
35
|
+
processInstanceComments: PropTypes.arrayOf(PropTypes.shape({
|
|
36
|
+
author: PropTypes.string,
|
|
37
|
+
id: PropTypes.string,
|
|
38
|
+
message: PropTypes.string,
|
|
39
|
+
time: PropTypes.number
|
|
40
|
+
})),
|
|
41
|
+
taskId: PropTypes.string
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WorkflowComments as default } from "./WorkflowComments";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WorkflowComments as default } from './WorkflowComments';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export const useCommentStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<never>;
|
|
2
|
+
export const useCollapsedCommentsStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"delimiter" | "circleButton">;
|
|
3
|
+
export const useWorkflowStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"title" | "container" | "commentsContainer" | "filledInputRoot">;
|
|
4
|
+
export const useExpandedComments: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"messageContainer">;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
2
|
+
export var useCommentStyles = makeStyles(function (_theme) { return ({
|
|
3
|
+
comment: {
|
|
4
|
+
display: 'flex',
|
|
5
|
+
flexDirection: 'row',
|
|
6
|
+
flex: 1,
|
|
7
|
+
marginLeft: '6px'
|
|
8
|
+
},
|
|
9
|
+
avatar: {
|
|
10
|
+
height: '24px',
|
|
11
|
+
width: '24px',
|
|
12
|
+
margin: '3px 13px 0 0'
|
|
13
|
+
},
|
|
14
|
+
icon: {
|
|
15
|
+
fill: '#537280',
|
|
16
|
+
backgroundColor: '#EAEDEE'
|
|
17
|
+
},
|
|
18
|
+
firstLine: {
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flexDirection: 'row'
|
|
21
|
+
},
|
|
22
|
+
info: {
|
|
23
|
+
flex: 1
|
|
24
|
+
},
|
|
25
|
+
author: {
|
|
26
|
+
flex: 1,
|
|
27
|
+
fontWeight: '500',
|
|
28
|
+
color: 'rgba(0,0,0,0.87)',
|
|
29
|
+
fontSize: '13px',
|
|
30
|
+
lineHeight: '15px'
|
|
31
|
+
},
|
|
32
|
+
date: {
|
|
33
|
+
color: 'rgba(0, 0, 0, 0.54)',
|
|
34
|
+
fontSize: '11px',
|
|
35
|
+
marginRight: '17px',
|
|
36
|
+
lineHeight: '15px'
|
|
37
|
+
},
|
|
38
|
+
text: {
|
|
39
|
+
color: 'rgba(0, 0, 0, 0.6)',
|
|
40
|
+
fontSize: '13px',
|
|
41
|
+
wordWrap: 'break-word'
|
|
42
|
+
}
|
|
43
|
+
}); });
|
|
44
|
+
export var useCollapsedCommentsStyles = makeStyles(function (_theme) { return ({
|
|
45
|
+
circleButton: {
|
|
46
|
+
maxWidth: '14px',
|
|
47
|
+
maxHeight: '14px',
|
|
48
|
+
border: '1px solid rgba(0, 0, 0, 0.3)',
|
|
49
|
+
fontSize: '13px',
|
|
50
|
+
color: 'rgba(0, 0, 0, 0.6)',
|
|
51
|
+
position: 'absolute',
|
|
52
|
+
top: '-11px',
|
|
53
|
+
left: '5px',
|
|
54
|
+
backgroundColor: '#ffffff',
|
|
55
|
+
'&:hover': {
|
|
56
|
+
backgroundColor: '#f7f7f7'
|
|
57
|
+
},
|
|
58
|
+
'&.focused': {
|
|
59
|
+
backgroundColor: '#f7f7f7'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
delimiter: {
|
|
63
|
+
position: 'relative',
|
|
64
|
+
height: '4px',
|
|
65
|
+
borderTop: '1px solid rgba(0, 0, 0, 0.3)',
|
|
66
|
+
borderBottom: '1px solid rgba(0, 0, 0, 0.3)',
|
|
67
|
+
margin: '15px 0 24px 0'
|
|
68
|
+
}
|
|
69
|
+
}); });
|
|
70
|
+
export var useWorkflowStyles = makeStyles(function (_theme) { return ({
|
|
71
|
+
container: {
|
|
72
|
+
padding: '5px 0',
|
|
73
|
+
display: 'flex',
|
|
74
|
+
flexDirection: 'column'
|
|
75
|
+
},
|
|
76
|
+
commentsContainer: {
|
|
77
|
+
maxHeight: '300px',
|
|
78
|
+
overflowY: 'auto'
|
|
79
|
+
},
|
|
80
|
+
title: {
|
|
81
|
+
margin: '0 0 8px 5px',
|
|
82
|
+
fontSize: '14px',
|
|
83
|
+
color: 'rgba(0, 0, 0, 0.87)'
|
|
84
|
+
},
|
|
85
|
+
filledInputRoot: {
|
|
86
|
+
backgroundColor: 'rgba(0, 0, 0, 0.03)',
|
|
87
|
+
padding: '0 6px',
|
|
88
|
+
height: '40px',
|
|
89
|
+
margin: '10px 17px 0 6px',
|
|
90
|
+
fontSize: '14px',
|
|
91
|
+
'&:hover': {
|
|
92
|
+
backgroundColor: 'rgba(0, 0, 0, 0.03)'
|
|
93
|
+
},
|
|
94
|
+
'&.focused': {
|
|
95
|
+
backgroundColor: 'rgba(0, 0, 0, 0.03)'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}); });
|
|
99
|
+
export var useExpandedComments = makeStyles(function (_theme) { return ({
|
|
100
|
+
messageContainer: {
|
|
101
|
+
borderBottom: '1px solid rgba(0,0,0,0.3)',
|
|
102
|
+
paddingBottom: '7px',
|
|
103
|
+
marginBottom: '7px'
|
|
104
|
+
}
|
|
105
|
+
}); });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import i18n from 'ui-i18n';
|
|
2
|
+
import { ApiErrorCode } from '@reltio/mdm-sdk';
|
|
3
|
+
import ErrorPopup from '../../ErrorPopup/ErrorPopup';
|
|
4
|
+
export var showWorkflowError = function (error) {
|
|
5
|
+
if (error === void 0) { error = {}; }
|
|
6
|
+
var errorMessage = error.errorMessage, errorCode = error.errorCode;
|
|
7
|
+
if (errorCode !== ApiErrorCode.WORKFLOW_IS_NOT_REGISTERED_ERROR) {
|
|
8
|
+
console.error(error); // eslint-disable-line
|
|
9
|
+
ErrorPopup.addError({
|
|
10
|
+
title: i18n.text('Error'),
|
|
11
|
+
message: errorMessage || i18n.text('Something went wrong...')
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { pipe, startsWith, isNil, unless, split, nth } from 'ramda';
|
|
2
|
+
var getDCRUri = function (objectUris) {
|
|
3
|
+
if (objectUris === void 0) { objectUris = []; }
|
|
4
|
+
return objectUris.find(startsWith('changeRequests/'));
|
|
5
|
+
};
|
|
6
|
+
var getDCRId = function (objectUris) {
|
|
7
|
+
if (objectUris === void 0) { objectUris = []; }
|
|
8
|
+
return pipe(getDCRUri, unless(isNil, pipe(split('/'), nth(1))))(objectUris);
|
|
9
|
+
};
|
|
10
|
+
export { getDCRUri, getDCRId };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WorkflowTaskData } from '@reltio/mdm-sdk';
|
|
2
|
+
declare type TaskAction = {
|
|
3
|
+
text: string;
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const useWorkflowActions: ({ possibleActions, assignee, taskId }: Pick<WorkflowTaskData, 'taskId' | 'possibleActions' | 'assignee'>) => {
|
|
7
|
+
actions: TaskAction[];
|
|
8
|
+
actionRequestIsInProgress: boolean;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useCallback, useContext, useMemo, useState } from 'react';
|
|
2
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
3
|
+
import { runTaskAction } from '@reltio/mdm-sdk';
|
|
4
|
+
import mdmModule, { profile, ui } from '@reltio/mdm-module';
|
|
5
|
+
import { ViewIdContext } from '../../../contexts/ViewIdContext';
|
|
6
|
+
import { showWorkflowError } from '../helpers/errors';
|
|
7
|
+
import { WorkflowTasksContext } from '../../../contexts/WorkflowTasksContext';
|
|
8
|
+
export var useWorkflowActions = function (_a) {
|
|
9
|
+
var possibleActions = _a.possibleActions, assignee = _a.assignee, taskId = _a.taskId;
|
|
10
|
+
var loadWorkflowTasks = (useContext(WorkflowTasksContext) || {}).loadWorkflowTasks;
|
|
11
|
+
var workflowPath = useSelector(mdmModule.selectors.getWorkflowPath);
|
|
12
|
+
var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
|
|
13
|
+
var tenant = useSelector(mdmModule.selectors.getTenant);
|
|
14
|
+
var username = useSelector(mdmModule.selectors.getUserName);
|
|
15
|
+
var entityUri = useSelector(mdmModule.selectors.getEntityUri);
|
|
16
|
+
var _b = useState(false), actionRequestIsInProgress = _b[0], setActionRequestIsInProgress = _b[1];
|
|
17
|
+
var viewId = useContext(ViewIdContext);
|
|
18
|
+
var dispatch = useDispatch();
|
|
19
|
+
var performTaskAction = useCallback(function (action) { return function () {
|
|
20
|
+
if (workflowPath && taskId) {
|
|
21
|
+
setActionRequestIsInProgress(true);
|
|
22
|
+
runTaskAction({
|
|
23
|
+
taskId: taskId,
|
|
24
|
+
workflowPath: workflowPath,
|
|
25
|
+
environment: environment,
|
|
26
|
+
tenant: tenant,
|
|
27
|
+
action: action
|
|
28
|
+
})
|
|
29
|
+
.then(function () {
|
|
30
|
+
if (action === 'Delete') {
|
|
31
|
+
dispatch(ui.actions.entityDeletionFinished());
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
// entity refreshing
|
|
35
|
+
dispatch(profile.entity.actions.loadEntity({ viewId: viewId, uri: entityUri }));
|
|
36
|
+
loadWorkflowTasks === null || loadWorkflowTasks === void 0 ? void 0 : loadWorkflowTasks();
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
.catch(showWorkflowError)
|
|
40
|
+
.finally(function () {
|
|
41
|
+
setActionRequestIsInProgress(false);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}; }, [workflowPath, taskId, environment, tenant, dispatch, entityUri, viewId, loadWorkflowTasks]);
|
|
45
|
+
var actions = useMemo(function () {
|
|
46
|
+
return username === assignee
|
|
47
|
+
? (possibleActions || []).map(function (_a) {
|
|
48
|
+
var action = _a.action, label = _a.label;
|
|
49
|
+
return ({
|
|
50
|
+
text: label,
|
|
51
|
+
onClick: performTaskAction(action)
|
|
52
|
+
});
|
|
53
|
+
})
|
|
54
|
+
: [];
|
|
55
|
+
}, [possibleActions, performTaskAction, username, assignee]);
|
|
56
|
+
return { actions: actions, actionRequestIsInProgress: actionRequestIsInProgress };
|
|
57
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { WorkflowTaskData } from '@reltio/mdm-sdk';
|
|
2
|
+
declare type AssigneeOption = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const useWorkflowAssignee: ({ assignee, taskId }: Pick<WorkflowTaskData, 'taskId' | 'assignee'>) => {
|
|
7
|
+
assignee: AssigneeOption;
|
|
8
|
+
getAssignees: (text: any) => Promise<void | unknown[]>;
|
|
9
|
+
updateAssignee: (newValue: AssigneeOption) => void;
|
|
10
|
+
updateRequestIsInProgress: boolean;
|
|
11
|
+
readOnly: boolean;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useState, useEffect, useCallback, useContext } from 'react';
|
|
2
|
+
import { filter } from 'ramda';
|
|
3
|
+
import { useSelector } from 'react-redux';
|
|
4
|
+
import { getAssigneeForTask, updateAssigneeForTask } from '@reltio/mdm-sdk';
|
|
5
|
+
import mdmModule from '@reltio/mdm-module';
|
|
6
|
+
import { useSafePromise } from '../../../hooks';
|
|
7
|
+
import { WorkflowTasksContext } from '../../../contexts/WorkflowTasksContext';
|
|
8
|
+
import { showWorkflowError } from '../helpers/errors';
|
|
9
|
+
import { useWorkflowCheckPermission } from './useWorkflowCheckPermission';
|
|
10
|
+
var assigneeToValue = function (assignee) { return ({
|
|
11
|
+
label: assignee,
|
|
12
|
+
value: assignee
|
|
13
|
+
}); };
|
|
14
|
+
export var useWorkflowAssignee = function (_a) {
|
|
15
|
+
var assignee = _a.assignee, taskId = _a.taskId;
|
|
16
|
+
var updateTaskState = (useContext(WorkflowTasksContext) || {}).updateTaskState;
|
|
17
|
+
var workflowPath = useSelector(mdmModule.selectors.getWorkflowPath);
|
|
18
|
+
var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
|
|
19
|
+
var tenant = useSelector(mdmModule.selectors.getTenant);
|
|
20
|
+
var updateSafePromise = useSafePromise();
|
|
21
|
+
var getSafePromise = useSafePromise();
|
|
22
|
+
var _b = useState(null), currentAssignee = _b[0], setCurrentAssignee = _b[1];
|
|
23
|
+
var _c = useState(), assignees = _c[0], setAssignees = _c[1];
|
|
24
|
+
var _d = useState(false), updateRequestIsInProgress = _d[0], setUpdateRequestIsInProgress = _d[1];
|
|
25
|
+
var checkWorkflowPermission = useWorkflowCheckPermission();
|
|
26
|
+
var canUpdateTask = checkWorkflowPermission('UPDATE_TASK');
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
setCurrentAssignee(assigneeToValue(assignee));
|
|
29
|
+
}, [assignee]);
|
|
30
|
+
var getAssignees = useCallback(function (text) {
|
|
31
|
+
if (workflowPath && canUpdateTask && taskId) {
|
|
32
|
+
var filterOutRest_1 = filter(function (item) { return item.value.toLowerCase().includes(text); });
|
|
33
|
+
if (assignees) {
|
|
34
|
+
return Promise.resolve(filterOutRest_1(assignees));
|
|
35
|
+
}
|
|
36
|
+
return getSafePromise(getAssigneeForTask({
|
|
37
|
+
taskId: taskId,
|
|
38
|
+
workflowPath: workflowPath,
|
|
39
|
+
environment: environment,
|
|
40
|
+
tenant: tenant
|
|
41
|
+
}))
|
|
42
|
+
.then(function (result) {
|
|
43
|
+
var data = result.data;
|
|
44
|
+
var assignees = data.map(assigneeToValue);
|
|
45
|
+
setAssignees(assignees);
|
|
46
|
+
return filterOutRest_1(assignees);
|
|
47
|
+
})
|
|
48
|
+
.catch(showWorkflowError);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
[workflowPath, taskId, environment, tenant, assignees, setAssignees, canUpdateTask]);
|
|
53
|
+
var updateAssignee = useCallback(function (newValue) {
|
|
54
|
+
if (workflowPath && canUpdateTask && taskId) {
|
|
55
|
+
var assignee_1 = newValue.value;
|
|
56
|
+
setUpdateRequestIsInProgress(true);
|
|
57
|
+
updateSafePromise(updateAssigneeForTask({
|
|
58
|
+
taskId: taskId,
|
|
59
|
+
workflowPath: workflowPath,
|
|
60
|
+
environment: environment,
|
|
61
|
+
tenant: tenant,
|
|
62
|
+
assignee: assignee_1
|
|
63
|
+
}))
|
|
64
|
+
.then(function () {
|
|
65
|
+
setCurrentAssignee(assigneeToValue(assignee_1));
|
|
66
|
+
updateTaskState === null || updateTaskState === void 0 ? void 0 : updateTaskState(taskId, { assignee: assignee_1 });
|
|
67
|
+
})
|
|
68
|
+
.catch(showWorkflowError)
|
|
69
|
+
.finally(function () {
|
|
70
|
+
setUpdateRequestIsInProgress(false);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
|
+
[workflowPath, taskId, environment, tenant, canUpdateTask]);
|
|
76
|
+
return {
|
|
77
|
+
assignee: currentAssignee,
|
|
78
|
+
getAssignees: getAssignees,
|
|
79
|
+
updateAssignee: updateAssignee,
|
|
80
|
+
updateRequestIsInProgress: updateRequestIsInProgress,
|
|
81
|
+
readOnly: !canUpdateTask
|
|
82
|
+
};
|
|
83
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useWorkflowCheckPermission: () => (permission: string) => boolean;
|