@reltio/components 1.4.885 → 1.4.890
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/ConfigureColumnsPopup/ConfigureColumnsPopup.js +17 -14
- package/cjs/components/DropDownSelector/DropDownSelector.d.ts +3 -1
- package/cjs/components/DropDownSelector/DropDownSelector.js +5 -3
- package/cjs/components/EntityTypesSelector/styles.d.ts +1 -1
- package/cjs/components/ErrorWrapper/styles.d.ts +1 -1
- package/cjs/components/attributes/editMode/AttributesPager/SpecialRenderer.js +2 -2
- package/cjs/components/attributes/editMode/Roles/Roles.d.ts +6 -0
- package/cjs/components/attributes/editMode/Roles/Roles.js +64 -0
- package/cjs/components/attributes/editMode/Roles/styles.d.ts +1 -0
- package/cjs/components/attributes/editMode/Roles/styles.js +10 -0
- package/cjs/components/crosswalks/CrosswalkDateEditor/CrosswalkDateEditor.js +1 -4
- package/cjs/components/editors/DateEditor/DateEditor.d.ts +14 -21
- package/cjs/components/editors/DateEditor/DateEditor.js +10 -19
- package/cjs/components/editors/DateEditor/styles.d.ts +1 -1
- package/cjs/components/editors/DateRangeEditor/styles.d.ts +1 -1
- package/cjs/components/editors/TimestampEditor/TimestampEditor.d.ts +18 -21
- package/cjs/components/editors/TimestampEditor/TimestampEditor.js +9 -19
- package/cjs/components/editors/TimestampEditor/styles.d.ts +1 -1
- package/cjs/components/workflow/cards/GenericWorkflowTaskCard/GenericWorkflowTaskCard.js +6 -6
- package/cjs/components/workflow/components/AssigneeSelector/AssigneeSelector.d.ts +4 -2
- package/cjs/components/workflow/components/AssigneeSelector/AssigneeSelector.js +3 -2
- package/cjs/components/workflow/components/DueDateField/DueDateField.d.ts +2 -1
- package/cjs/components/workflow/components/DueDateField/DueDateField.js +6 -2
- package/cjs/components/workflow/components/DueDateField/styles.d.ts +1 -1
- package/cjs/components/workflow/components/PrioritySelector/PrioritySelector.d.ts +2 -1
- package/cjs/components/workflow/components/PrioritySelector/PrioritySelector.js +6 -2
- package/cjs/components/workflow/components/TaskActions/TaskActions.d.ts +4 -2
- package/cjs/components/workflow/components/TaskActions/TaskActions.js +7 -2
- package/cjs/components/workflow/components/WorkflowComments/WorkflowComments.d.ts +2 -1
- package/cjs/components/workflow/components/WorkflowComments/WorkflowComments.js +6 -2
- package/cjs/components/workflow/helpers/index.d.ts +3 -1
- package/cjs/components/workflow/helpers/index.js +3 -1
- package/cjs/components/workflow/hooks/useWorkflowActions.d.ts +1 -1
- package/cjs/components/workflow/hooks/useWorkflowActions.js +4 -3
- package/cjs/components/workflow/hooks/useWorkflowAssignee.d.ts +1 -1
- package/cjs/components/workflow/hooks/useWorkflowAssignee.js +3 -2
- package/cjs/components/workflow/hooks/useWorkflowComments.d.ts +1 -1
- package/cjs/components/workflow/hooks/useWorkflowComments.js +3 -2
- package/cjs/components/workflow/hooks/useWorkflowDueDate.d.ts +1 -1
- package/cjs/components/workflow/hooks/useWorkflowDueDate.js +3 -2
- package/cjs/components/workflow/hooks/useWorkflowPriority.d.ts +1 -1
- package/cjs/components/workflow/hooks/useWorkflowPriority.js +3 -2
- package/cjs/{hooks → components/workflow/hooks}/useWorkflowTasks.d.ts +7 -1
- package/cjs/{hooks → components/workflow/hooks}/useWorkflowTasks.js +28 -17
- package/cjs/components/workflow/index.d.ts +1 -0
- package/cjs/components/workflow/index.js +3 -1
- package/cjs/constants/prop-types.d.ts +0 -1
- package/cjs/constants/prop-types.js +1 -3
- package/cjs/hooks/index.d.ts +0 -1
- package/cjs/hooks/index.js +1 -3
- package/esm/components/ConfigureColumnsPopup/ConfigureColumnsPopup.js +17 -14
- package/esm/components/DropDownSelector/DropDownSelector.d.ts +3 -1
- package/esm/components/DropDownSelector/DropDownSelector.js +5 -3
- package/esm/components/EntityTypesSelector/styles.d.ts +1 -1
- package/esm/components/ErrorWrapper/styles.d.ts +1 -1
- package/esm/components/attributes/editMode/AttributesPager/SpecialRenderer.js +1 -1
- package/esm/components/attributes/editMode/Roles/Roles.d.ts +6 -0
- package/esm/components/attributes/editMode/Roles/Roles.js +38 -0
- package/esm/components/attributes/editMode/Roles/styles.d.ts +1 -0
- package/esm/components/attributes/editMode/Roles/styles.js +7 -0
- package/esm/components/crosswalks/CrosswalkDateEditor/CrosswalkDateEditor.js +1 -4
- package/esm/components/editors/DateEditor/DateEditor.d.ts +14 -21
- package/esm/components/editors/DateEditor/DateEditor.js +10 -19
- package/esm/components/editors/DateEditor/styles.d.ts +1 -1
- package/esm/components/editors/DateRangeEditor/styles.d.ts +1 -1
- package/esm/components/editors/TimestampEditor/TimestampEditor.d.ts +18 -21
- package/esm/components/editors/TimestampEditor/TimestampEditor.js +9 -19
- package/esm/components/editors/TimestampEditor/styles.d.ts +1 -1
- package/esm/components/workflow/cards/GenericWorkflowTaskCard/GenericWorkflowTaskCard.js +6 -6
- package/esm/components/workflow/components/AssigneeSelector/AssigneeSelector.d.ts +4 -2
- package/esm/components/workflow/components/AssigneeSelector/AssigneeSelector.js +3 -2
- package/esm/components/workflow/components/DueDateField/DueDateField.d.ts +2 -1
- package/esm/components/workflow/components/DueDateField/DueDateField.js +6 -2
- package/esm/components/workflow/components/DueDateField/styles.d.ts +1 -1
- package/esm/components/workflow/components/PrioritySelector/PrioritySelector.d.ts +2 -1
- package/esm/components/workflow/components/PrioritySelector/PrioritySelector.js +6 -2
- package/esm/components/workflow/components/TaskActions/TaskActions.d.ts +4 -2
- package/esm/components/workflow/components/TaskActions/TaskActions.js +7 -2
- package/esm/components/workflow/components/WorkflowComments/WorkflowComments.d.ts +2 -1
- package/esm/components/workflow/components/WorkflowComments/WorkflowComments.js +6 -2
- package/esm/components/workflow/helpers/index.d.ts +3 -1
- package/esm/components/workflow/helpers/index.js +2 -1
- package/esm/components/workflow/hooks/useWorkflowActions.d.ts +1 -1
- package/esm/components/workflow/hooks/useWorkflowActions.js +4 -3
- package/esm/components/workflow/hooks/useWorkflowAssignee.d.ts +1 -1
- package/esm/components/workflow/hooks/useWorkflowAssignee.js +3 -2
- package/esm/components/workflow/hooks/useWorkflowComments.d.ts +1 -1
- package/esm/components/workflow/hooks/useWorkflowComments.js +3 -2
- package/esm/components/workflow/hooks/useWorkflowDueDate.d.ts +1 -1
- package/esm/components/workflow/hooks/useWorkflowDueDate.js +3 -2
- package/esm/components/workflow/hooks/useWorkflowPriority.d.ts +1 -1
- package/esm/components/workflow/hooks/useWorkflowPriority.js +3 -2
- package/esm/{hooks → components/workflow/hooks}/useWorkflowTasks.d.ts +7 -1
- package/esm/{hooks → components/workflow/hooks}/useWorkflowTasks.js +28 -17
- package/esm/components/workflow/index.d.ts +1 -0
- package/esm/components/workflow/index.js +1 -0
- package/esm/constants/prop-types.d.ts +0 -1
- package/esm/constants/prop-types.js +1 -2
- package/esm/hooks/index.d.ts +0 -1
- package/esm/hooks/index.js +0 -1
- package/package.json +10 -3
|
@@ -20,28 +20,27 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
-
import
|
|
23
|
+
import { KeyboardDatePicker } from '@material-ui/pickers';
|
|
24
|
+
import { debounce, utils } from '@reltio/mdm-sdk';
|
|
25
|
+
import classnames from 'classnames';
|
|
26
|
+
import moment from 'moment';
|
|
27
|
+
import { invoker, isNil, pipe, when } from 'ramda';
|
|
24
28
|
import React, { useState } from 'react';
|
|
25
29
|
import i18n from 'ui-i18n';
|
|
26
|
-
import moment from 'moment';
|
|
27
|
-
import classnames from 'classnames';
|
|
28
|
-
import { pipe, when, isNil, invoker } from 'ramda';
|
|
29
|
-
import { utils, debounce } from '@reltio/mdm-sdk';
|
|
30
|
-
import { KeyboardDatePicker } from '@material-ui/pickers';
|
|
31
|
-
import { InputVariant } from '../../../constants/prop-types';
|
|
32
30
|
import CalendarIcon from '../../../icons/Calendar';
|
|
31
|
+
import { noop } from '../../../core';
|
|
33
32
|
import { useStyles } from './styles';
|
|
34
33
|
var format = moment.localeData().longDateFormat('L');
|
|
35
34
|
var DateEditor = function (_a) {
|
|
36
35
|
var _b, _c;
|
|
37
36
|
var _d;
|
|
38
|
-
var _e = _a.value, value = _e === void 0 ? null : _e, label = _a.label, _f = _a.variant, variant = _f === void 0 ? 'filled' : _f, onChange = _a.onChange, _g = _a.InputProps, InputProps = _g === void 0 ? {} : _g, _h = _a.InputLabelProps, InputLabelProps = _h === void 0 ? {} : _h, otherProps = __rest(_a, ["value", "label", "variant", "onChange", "InputProps", "InputLabelProps"]);
|
|
37
|
+
var _e = _a.value, value = _e === void 0 ? null : _e, label = _a.label, _f = _a.variant, variant = _f === void 0 ? 'filled' : _f, onChange = _a.onChange, _g = _a.InputProps, InputProps = _g === void 0 ? {} : _g, _h = _a.InputLabelProps, InputLabelProps = _h === void 0 ? {} : _h, _j = _a.onBlur, onBlur = _j === void 0 ? noop : _j, _k = _a.onFocus, onFocus = _k === void 0 ? noop : _k, otherProps = __rest(_a, ["value", "label", "variant", "onChange", "InputProps", "InputLabelProps", "onBlur", "onFocus"]);
|
|
39
38
|
var styles = useStyles();
|
|
40
|
-
var
|
|
41
|
-
return (React.createElement(KeyboardDatePicker, __assign({ format: format, variant: "inline", invalidDateMessage: i18n.text('Invalid Date Format'), maxDateMessage: i18n.text('Date should not be after maximal date'), minDateMessage: i18n.text('Date should not be before minimal date'), inputVariant: variant, autoOk: true, InputAdornmentProps: { position: 'end', classes: { positionEnd: styles.adornmentPositionEnd } }, KeyboardButtonProps: {
|
|
39
|
+
var _l = useState(false), isCalendarOpen = _l[0], setIsCalendarOpen = _l[1];
|
|
40
|
+
return (React.createElement(KeyboardDatePicker, __assign({ format: format, variant: "inline", invalidDateMessage: i18n.text('Invalid Date Format'), maxDateMessage: i18n.text('Date should not be after maximal date'), minDateMessage: i18n.text('Date should not be before minimal date'), inputVariant: variant, autoOk: true, onBlur: onBlur, onFocus: onFocus, InputAdornmentProps: { position: 'end', classes: { positionEnd: styles.adornmentPositionEnd } }, KeyboardButtonProps: {
|
|
42
41
|
classes: { root: styles.iconButtonRoot },
|
|
43
42
|
onKeyPress: invoker(0, 'stopPropagation')
|
|
44
|
-
}, keyboardIcon: React.createElement(CalendarIcon, { className: styles.icon }), onChange: debounce(when(utils.dates.isValidMomentDateOrNull, pipe(utils.dates.momentToDate, utils.dates.clearDateTime, onChange)), 0), label: label, "aria-label": label, value: value, placeholder: i18n.text(format),
|
|
43
|
+
}, keyboardIcon: React.createElement(CalendarIcon, { className: styles.icon }), onChange: debounce(when(utils.dates.isValidMomentDateOrNull, pipe(utils.dates.momentToDate, utils.dates.clearDateTime, onChange)), 0), label: label, "aria-label": label, value: value, placeholder: i18n.text(format), onClose: function () { return setIsCalendarOpen(false); }, onOpen: function () { return setIsCalendarOpen(true); }, InputProps: __assign({ classes: {
|
|
45
44
|
root: styles.inputRoot,
|
|
46
45
|
underline: classnames((_b = {}, _b[styles.underline] = isCalendarOpen, _b)),
|
|
47
46
|
adornedEnd: styles.adornedEnd
|
|
@@ -56,12 +55,4 @@ var DateEditor = function (_a) {
|
|
|
56
55
|
}
|
|
57
56
|
}, InputLabelProps: __assign({ classes: __assign({ root: classnames((_c = {}, _c[styles.inputLabel] = isCalendarOpen, _c), (_d = InputLabelProps === null || InputLabelProps === void 0 ? void 0 : InputLabelProps.classes) === null || _d === void 0 ? void 0 : _d.root) }, InputLabelProps === null || InputLabelProps === void 0 ? void 0 : InputLabelProps.classes), shrink: !isNil(label) }, InputLabelProps) }, otherProps)));
|
|
58
57
|
};
|
|
59
|
-
DateEditor.propTypes = {
|
|
60
|
-
value: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]),
|
|
61
|
-
label: PropTypes.string,
|
|
62
|
-
variant: InputVariant,
|
|
63
|
-
InputProps: PropTypes.object,
|
|
64
|
-
InputLabelProps: PropTypes.object,
|
|
65
|
-
onChange: PropTypes.func.isRequired
|
|
66
|
-
};
|
|
67
58
|
export default DateEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"underline" | "icon" | "adornedEnd" | "
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"underline" | "icon" | "adornedEnd" | "iconButtonRoot" | "inputLabel" | "inputRoot" | "adornmentPositionEnd">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"underline" | "dropdownIndicator" | "adornedEnd" | "
|
|
1
|
+
export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"underline" | "dropdownIndicator" | "adornedEnd" | "inputLabel" | "inputRoot" | "paper" | "menuItem" | "menuText">;
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { InputLabelProps } from '@material-ui/core/InputLabel';
|
|
3
|
+
import { TextFieldProps } from '@material-ui/core/TextField';
|
|
4
|
+
import { Moment } from 'moment';
|
|
5
|
+
import { KeyboardDateTimePickerProps } from '@material-ui/pickers/DateTimePicker';
|
|
6
|
+
declare type TimestampEditorProps = {
|
|
7
|
+
value: number | Date;
|
|
8
|
+
label?: string;
|
|
9
|
+
variant: TextFieldProps['variant'];
|
|
10
|
+
InputProps: TextFieldProps['InputProps'];
|
|
11
|
+
format?: string;
|
|
12
|
+
InputLabelProps?: Partial<InputLabelProps>;
|
|
13
|
+
onBlur?: () => void;
|
|
14
|
+
onFocus?: () => void;
|
|
15
|
+
onChange: (value: number | Date) => void;
|
|
16
|
+
onAccept: (value: number | Date | Moment) => void;
|
|
17
|
+
} & Omit<KeyboardDateTimePickerProps, 'value' | 'label' | 'variant' | 'size' | 'hiddenLabel' | 'onBlur' | 'onFocus' | 'onChange' | 'onAccept'>;
|
|
18
|
+
declare const TimestampEditor: ({ value, label, variant, onChange, InputProps, format, ...otherProps }: TimestampEditorProps) => JSX.Element;
|
|
1
19
|
export default TimestampEditor;
|
|
2
|
-
declare function TimestampEditor({ value, label, variant, onChange, InputProps, format, ...otherProps }: {
|
|
3
|
-
[x: string]: any;
|
|
4
|
-
value?: any;
|
|
5
|
-
label: any;
|
|
6
|
-
variant?: string;
|
|
7
|
-
onChange: any;
|
|
8
|
-
InputProps: any;
|
|
9
|
-
format: any;
|
|
10
|
-
}): JSX.Element;
|
|
11
|
-
declare namespace TimestampEditor {
|
|
12
|
-
namespace propTypes {
|
|
13
|
-
export const value: PropTypes.Requireable<number | Date>;
|
|
14
|
-
export const format: PropTypes.Requireable<string>;
|
|
15
|
-
export const label: PropTypes.Requireable<string>;
|
|
16
|
-
export { InputVariant as variant };
|
|
17
|
-
export const InputProps: PropTypes.Requireable<object>;
|
|
18
|
-
export const onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
import PropTypes from "prop-types";
|
|
22
|
-
import { InputVariant } from "../../../constants/prop-types";
|
|
@@ -20,17 +20,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
-
import PropTypes from 'prop-types';
|
|
24
|
-
import React, { useState } from 'react';
|
|
25
|
-
import i18n from 'ui-i18n';
|
|
26
|
-
import moment from 'moment';
|
|
27
|
-
import classnames from 'classnames';
|
|
28
|
-
import { pipe, when, isNil, invoker } from 'ramda';
|
|
29
|
-
import { makeMaskFromFormat, maskedDateFormatter } from '@material-ui/pickers/_helpers/text-field-helper';
|
|
30
|
-
import { KeyboardDateTimePicker } from '@material-ui/pickers';
|
|
31
23
|
import DateRangeIcon from '@material-ui/icons/DateRange';
|
|
24
|
+
import { KeyboardDateTimePicker } from '@material-ui/pickers';
|
|
25
|
+
import { makeMaskFromFormat, maskedDateFormatter } from '@material-ui/pickers/_helpers/text-field-helper';
|
|
32
26
|
import { utils } from '@reltio/mdm-sdk';
|
|
33
|
-
import
|
|
27
|
+
import classnames from 'classnames';
|
|
28
|
+
import moment from 'moment';
|
|
29
|
+
import { invoker, isNil, pipe, when } from 'ramda';
|
|
30
|
+
import React, { useState } from 'react';
|
|
31
|
+
import i18n from 'ui-i18n';
|
|
34
32
|
import { useStyles } from './styles';
|
|
35
33
|
var dateFormat = moment.localeData().longDateFormat('L');
|
|
36
34
|
var timeFormat = moment.localeData().longDateFormat('LTS');
|
|
@@ -42,10 +40,10 @@ var TimestampEditor = function (_a) {
|
|
|
42
40
|
var _e = useState(false), isCalendarOpen = _e[0], setIsCalendarOpen = _e[1];
|
|
43
41
|
var timestampFormat = format || dateFormat + " " + timeFormat;
|
|
44
42
|
var isAmPmFormat = timestampFormat && timestampFormat.toLowerCase().includes('a');
|
|
45
|
-
return (React.createElement(KeyboardDateTimePicker, __assign({ format: timestampFormat, rifmFormatter: isAmPmFormat ? makeAmPmFormatter(timestampFormat) : undefined, variant: "inline", invalidDateMessage: i18n.text('Invalid Date Format'), maxDateMessage: i18n.text('Date should not be after maximal date'), minDateMessage: i18n.text('Date should not be before minimal date'), inputVariant: variant, views: ['year', 'date', 'hours', 'minutes'
|
|
43
|
+
return (React.createElement(KeyboardDateTimePicker, __assign({ format: timestampFormat, rifmFormatter: isAmPmFormat ? makeAmPmFormatter(timestampFormat) : undefined, variant: "inline", invalidDateMessage: i18n.text('Invalid Date Format'), maxDateMessage: i18n.text('Date should not be after maximal date'), minDateMessage: i18n.text('Date should not be before minimal date'), inputVariant: variant, views: ['year', 'date', 'hours', 'minutes'], autoOk: true, InputAdornmentProps: { position: 'end' }, KeyboardButtonProps: {
|
|
46
44
|
classes: { root: styles.iconButtonRoot },
|
|
47
45
|
onKeyPress: invoker(0, 'stopPropagation')
|
|
48
|
-
}, keyboardIcon: React.createElement(DateRangeIcon, null), onChange: when(utils.dates.isValidMomentDateOrNull, pipe(utils.dates.momentToDate, onChange)), label: label, "aria-label": label, value: value, placeholder: i18n.text((dateFormat + " HH:MM").toUpperCase()), ampm: false,
|
|
46
|
+
}, keyboardIcon: React.createElement(DateRangeIcon, null), onChange: when(utils.dates.isValidMomentDateOrNull, pipe(utils.dates.momentToDate, onChange)), label: label, "aria-label": label, value: value, placeholder: i18n.text((dateFormat + " HH:MM").toUpperCase()), ampm: false, onClose: function () { return setIsCalendarOpen(false); }, onOpen: function () { return setIsCalendarOpen(true); }, InputProps: __assign({ classes: {
|
|
49
47
|
root: styles.inputRoot,
|
|
50
48
|
underline: classnames((_b = {}, _b[styles.underline] = isCalendarOpen, _b)),
|
|
51
49
|
adornedEnd: styles.adornedEnd
|
|
@@ -65,12 +63,4 @@ var TimestampEditor = function (_a) {
|
|
|
65
63
|
shrink: !isNil(label)
|
|
66
64
|
} }, otherProps)));
|
|
67
65
|
};
|
|
68
|
-
TimestampEditor.propTypes = {
|
|
69
|
-
value: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]),
|
|
70
|
-
format: PropTypes.string,
|
|
71
|
-
label: PropTypes.string,
|
|
72
|
-
variant: InputVariant,
|
|
73
|
-
InputProps: PropTypes.object,
|
|
74
|
-
onChange: PropTypes.func.isRequired
|
|
75
|
-
};
|
|
76
66
|
export default TimestampEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"underline" | "adornedEnd" | "
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"underline" | "adornedEnd" | "iconButtonRoot" | "inputLabel" | "inputRoot">;
|
|
@@ -18,7 +18,7 @@ import CollaborationIcon from '../../../../icons/CollaborationIcon';
|
|
|
18
18
|
var GenericWorkflowTaskCard = function (_a) {
|
|
19
19
|
var _b;
|
|
20
20
|
var task = _a.task, children = _a.children, actions = _a.actions, Icon = _a.Icon;
|
|
21
|
-
var taskId = task.taskId, dueDate = task.dueDate, priority = task.priority, assignee = task.assignee, createdBy = task.createdBy, createTime = task.createTime, step = task.displayName, processDefinitionDisplayName = task.processDefinitionDisplayName, objectURIs = task.objectURIs, processInstanceComments = task.processInstanceComments, possibleActions = task.possibleActions;
|
|
21
|
+
var taskId = task.taskId, dueDate = task.dueDate, priority = task.priority, assignee = task.assignee, createdBy = task.createdBy, createTime = task.createTime, step = task.displayName, processDefinitionDisplayName = task.processDefinitionDisplayName, objectURIs = task.objectURIs, processInstanceComments = task.processInstanceComments, possibleActions = task.possibleActions, isTaskOpen = task.isOpen;
|
|
22
22
|
var dcrId = getDCRId(objectURIs);
|
|
23
23
|
var color = useWorkflowColor({ processDefinitionDisplayName: processDefinitionDisplayName });
|
|
24
24
|
var styles = useStyles({ color: color });
|
|
@@ -61,16 +61,16 @@ var GenericWorkflowTaskCard = function (_a) {
|
|
|
61
61
|
canViewComments && (processInstanceComments === null || processInstanceComments === void 0 ? void 0 : processInstanceComments.length) > 0 && (React.createElement("div", { className: styles.commentsInfo },
|
|
62
62
|
React.createElement(CollaborationIcon, { className: styles.commentsIcon }),
|
|
63
63
|
React.createElement("div", { className: styles.infoValue }, processInstanceComments.length)))),
|
|
64
|
-
actions || (React.createElement(TaskActions, { taskId: taskId, possibleActions: possibleActions, assignee: assignee })))))),
|
|
64
|
+
actions || (React.createElement(TaskActions, { taskId: taskId, possibleActions: possibleActions, assignee: assignee, isTaskOpen: isTaskOpen })))))),
|
|
65
65
|
isExpanded && (React.createElement(LineDecorator, { plain: true },
|
|
66
66
|
React.createElement("div", { className: styles.controlsBox },
|
|
67
67
|
React.createElement("div", { className: styles.controlsInRow },
|
|
68
|
-
React.createElement(DueDateField, { taskId: taskId, dueDate: dueDate }),
|
|
69
|
-
React.createElement(PrioritySelector, { taskId: taskId, priority: priority, className: styles.priority })),
|
|
70
|
-
React.createElement(AssigneeSelector, { taskId: taskId, assignee: assignee }))))),
|
|
68
|
+
React.createElement(DueDateField, { taskId: taskId, dueDate: dueDate, isTaskOpen: isTaskOpen }),
|
|
69
|
+
React.createElement(PrioritySelector, { taskId: taskId, priority: priority, className: styles.priority, isTaskOpen: isTaskOpen })),
|
|
70
|
+
React.createElement(AssigneeSelector, { taskId: taskId, assignee: assignee, isTaskOpen: isTaskOpen }))))),
|
|
71
71
|
isExpanded && (React.createElement(React.Fragment, null,
|
|
72
72
|
children,
|
|
73
73
|
canViewComments && (React.createElement("div", { className: styles.comments },
|
|
74
|
-
React.createElement(WorkflowComments, { taskId: taskId, processInstanceComments: processInstanceComments })))))));
|
|
74
|
+
React.createElement(WorkflowComments, { taskId: taskId, processInstanceComments: processInstanceComments, isTaskOpen: isTaskOpen })))))));
|
|
75
75
|
};
|
|
76
76
|
export default GenericWorkflowTaskCard;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WorkflowTaskData } from '@reltio/mdm-sdk';
|
|
3
|
-
declare type Props = Pick<WorkflowTaskData, 'taskId' | 'assignee'
|
|
4
|
-
|
|
3
|
+
declare type Props = Pick<WorkflowTaskData, 'taskId' | 'assignee'> & {
|
|
4
|
+
isTaskOpen?: WorkflowTaskData['isOpen'];
|
|
5
|
+
};
|
|
6
|
+
declare const AssigneeSelector: ({ taskId, assignee, isTaskOpen }: Props) => JSX.Element;
|
|
5
7
|
export default AssigneeSelector;
|
|
@@ -3,10 +3,11 @@ import i18n from 'ui-i18n';
|
|
|
3
3
|
import DropDownSelector from '../../../DropDownSelector/DropDownSelector';
|
|
4
4
|
import { useWorkflowAssignee } from '../../hooks/useWorkflowAssignee';
|
|
5
5
|
var AssigneeSelector = function (_a) {
|
|
6
|
-
var taskId = _a.taskId, assignee = _a.assignee;
|
|
6
|
+
var taskId = _a.taskId, assignee = _a.assignee, isTaskOpen = _a.isTaskOpen;
|
|
7
7
|
var _b = useWorkflowAssignee({
|
|
8
8
|
taskId: taskId,
|
|
9
|
-
assignee: assignee
|
|
9
|
+
assignee: assignee,
|
|
10
|
+
isOpen: isTaskOpen
|
|
10
11
|
}), currentAssignee = _b.assignee, getAssignees = _b.getAssignees, updateAssignee = _b.updateAssignee, updateRequestIsInProgress = _b.updateRequestIsInProgress, readOnly = _b.readOnly;
|
|
11
12
|
var disabled = updateRequestIsInProgress || readOnly;
|
|
12
13
|
return (React.createElement(DropDownSelector, { isDisabled: disabled, getOptions: getAssignees, onChange: updateAssignee, hideSelectedOptions: false, label: i18n.text('Assigned to'), value: currentAssignee, defaultOptions: true, TextFieldProps: { disabled: disabled }, height: 40 }));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WorkflowTaskData } from '@reltio/mdm-sdk';
|
|
3
3
|
declare type Props = Pick<WorkflowTaskData, 'taskId' | 'dueDate'> & {
|
|
4
|
+
isTaskOpen?: WorkflowTaskData['isOpen'];
|
|
4
5
|
className?: string;
|
|
5
6
|
};
|
|
6
|
-
declare const DueDateField: ({ taskId, dueDate, className }: Props) => JSX.Element;
|
|
7
|
+
declare const DueDateField: ({ taskId, dueDate, isTaskOpen, className }: Props) => JSX.Element;
|
|
7
8
|
export default DueDateField;
|
|
@@ -6,9 +6,13 @@ import { useStyles } from './styles';
|
|
|
6
6
|
import { DateEditor } from '../../../editors';
|
|
7
7
|
import { useWorkflowDueDate } from '../../hooks/useWorkflowDueDate';
|
|
8
8
|
var DueDateField = function (_a) {
|
|
9
|
-
var taskId = _a.taskId, dueDate = _a.dueDate, className = _a.className;
|
|
9
|
+
var taskId = _a.taskId, dueDate = _a.dueDate, isTaskOpen = _a.isTaskOpen, className = _a.className;
|
|
10
10
|
var styles = useStyles();
|
|
11
|
-
var _b = useWorkflowDueDate({
|
|
11
|
+
var _b = useWorkflowDueDate({
|
|
12
|
+
dueDate: dueDate,
|
|
13
|
+
taskId: taskId,
|
|
14
|
+
isOpen: isTaskOpen
|
|
15
|
+
}), updateDueDate = _b.updateDueDate, updateRequestIsInProgress = _b.updateRequestIsInProgress, readOnly = _b.readOnly;
|
|
12
16
|
return (React.createElement(DateEditor, { className: classnames(styles.dueDate, className), disabled: updateRequestIsInProgress || readOnly, value: dueDate, label: i18n.text('Due date'), onChange: pipe(function (date) { return date && date.getTime(); }, updateDueDate), margin: "dense", InputProps: { className: styles.dueDateInput }, InputLabelProps: { classes: { root: styles.inputLabel } } }));
|
|
13
17
|
};
|
|
14
18
|
export default DueDateField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"dueDate" | "
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"dueDate" | "inputLabel" | "dueDateInput">;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WorkflowTaskData } from '@reltio/mdm-sdk';
|
|
3
3
|
declare type Props = Pick<WorkflowTaskData, 'taskId' | 'priority'> & {
|
|
4
|
+
isTaskOpen?: WorkflowTaskData['isOpen'];
|
|
4
5
|
className?: string;
|
|
5
6
|
};
|
|
6
|
-
declare const PrioritySelector: ({ taskId, priority, className }: Props) => JSX.Element;
|
|
7
|
+
declare const PrioritySelector: ({ taskId, priority, isTaskOpen, className }: Props) => JSX.Element;
|
|
7
8
|
export default PrioritySelector;
|
|
@@ -4,8 +4,12 @@ import { propEq } from 'ramda';
|
|
|
4
4
|
import DropDownSelector from '../../../DropDownSelector/DropDownSelector';
|
|
5
5
|
import { useWorkflowPriority } from '../../hooks/useWorkflowPriority';
|
|
6
6
|
var PrioritySelector = function (_a) {
|
|
7
|
-
var taskId = _a.taskId, priority = _a.priority, className = _a.className;
|
|
8
|
-
var _b = useWorkflowPriority({
|
|
7
|
+
var taskId = _a.taskId, priority = _a.priority, isTaskOpen = _a.isTaskOpen, className = _a.className;
|
|
8
|
+
var _b = useWorkflowPriority({
|
|
9
|
+
taskId: taskId,
|
|
10
|
+
priority: priority,
|
|
11
|
+
isOpen: isTaskOpen
|
|
12
|
+
}), priorities = _b.priorities, updatePriority = _b.updatePriority, updateRequestIsInProgress = _b.updateRequestIsInProgress, readOnly = _b.readOnly;
|
|
9
13
|
var disabled = updateRequestIsInProgress || readOnly;
|
|
10
14
|
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
15
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WorkflowTaskData } from '@reltio/mdm-sdk';
|
|
3
|
-
declare type Props = Pick<WorkflowTaskData, 'taskId' | 'possibleActions' | 'assignee'
|
|
4
|
-
|
|
3
|
+
declare type Props = Pick<WorkflowTaskData, 'taskId' | 'possibleActions' | 'assignee'> & {
|
|
4
|
+
isTaskOpen?: WorkflowTaskData['isOpen'];
|
|
5
|
+
};
|
|
6
|
+
declare const TaskActions: ({ taskId, possibleActions, assignee, isTaskOpen }: Props) => JSX.Element;
|
|
5
7
|
export default TaskActions;
|
|
@@ -4,8 +4,13 @@ import { useWorkflowActions } from '../../hooks/useWorkflowActions';
|
|
|
4
4
|
import DropDownMenuButton from '../../../DropDownMenuButton/DropDownMenuButton';
|
|
5
5
|
import SmallIconButton from '../../../SmallIconButton/SmallIconButton';
|
|
6
6
|
var TaskActions = function (_a) {
|
|
7
|
-
var taskId = _a.taskId, possibleActions = _a.possibleActions, assignee = _a.assignee;
|
|
8
|
-
var _b = useWorkflowActions({
|
|
7
|
+
var taskId = _a.taskId, possibleActions = _a.possibleActions, assignee = _a.assignee, isTaskOpen = _a.isTaskOpen;
|
|
8
|
+
var _b = useWorkflowActions({
|
|
9
|
+
taskId: taskId,
|
|
10
|
+
possibleActions: possibleActions,
|
|
11
|
+
assignee: assignee,
|
|
12
|
+
isOpen: isTaskOpen
|
|
13
|
+
}), actions = _b.actions, disabled = _b.actionRequestIsInProgress;
|
|
9
14
|
return actions.length > 0 ? (React.createElement(DropDownMenuButton, { buttonComponent: SmallIconButton, buttonProps: {
|
|
10
15
|
icon: MoreVertIcon,
|
|
11
16
|
size: 'L',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export function WorkflowComments({ processInstanceComments, taskId }: {
|
|
1
|
+
export function WorkflowComments({ processInstanceComments, taskId, isTaskOpen }: {
|
|
2
2
|
processInstanceComments: any;
|
|
3
3
|
taskId: any;
|
|
4
|
+
isTaskOpen: any;
|
|
4
5
|
}): JSX.Element;
|
|
5
6
|
export namespace WorkflowComments {
|
|
6
7
|
namespace propTypes {
|
|
@@ -12,11 +12,15 @@ import { useWorkflowComments } from '../../hooks/useWorkflowComments';
|
|
|
12
12
|
import { SmallIconButton } from '../../../SmallIconButton';
|
|
13
13
|
var getValue = function (e) { return e.target.value; };
|
|
14
14
|
export var WorkflowComments = function (_a) {
|
|
15
|
-
var processInstanceComments = _a.processInstanceComments, taskId = _a.taskId;
|
|
15
|
+
var processInstanceComments = _a.processInstanceComments, taskId = _a.taskId, isTaskOpen = _a.isTaskOpen;
|
|
16
16
|
var styles = useWorkflowStyles();
|
|
17
17
|
var _b = useState(false), expanded = _b[0], setExpanded = _b[1];
|
|
18
18
|
var _c = useState(''), comment = _c[0], setComment = _c[1];
|
|
19
|
-
var _d = useWorkflowComments({
|
|
19
|
+
var _d = useWorkflowComments({
|
|
20
|
+
processInstanceComments: processInstanceComments,
|
|
21
|
+
taskId: taskId,
|
|
22
|
+
isOpen: isTaskOpen
|
|
23
|
+
}), comments = _d.comments, writeComment = _d.writeComment, readOnly = _d.readOnly;
|
|
20
24
|
var sendComment = useCallback(function () {
|
|
21
25
|
writeComment(comment);
|
|
22
26
|
setComment('');
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { WorkflowTaskData } from '@reltio/mdm-sdk';
|
|
1
2
|
declare const getDCRUri: (objectUris?: string[]) => string;
|
|
2
3
|
declare const getDCRId: (objectUris?: string[]) => string;
|
|
3
|
-
|
|
4
|
+
declare const isOpenTask: (isOpen: WorkflowTaskData['isOpen']) => boolean;
|
|
5
|
+
export { getDCRUri, getDCRId, isOpenTask };
|
|
@@ -7,4 +7,5 @@ var getDCRId = function (objectUris) {
|
|
|
7
7
|
if (objectUris === void 0) { objectUris = []; }
|
|
8
8
|
return pipe(getDCRUri, unless(isNil, pipe(split('/'), nth(1))))(objectUris);
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
var isOpenTask = function (isOpen) { return isOpen === undefined || isOpen === true; };
|
|
11
|
+
export { getDCRUri, getDCRId, isOpenTask };
|
|
@@ -3,7 +3,7 @@ declare type TaskAction = {
|
|
|
3
3
|
text: string;
|
|
4
4
|
onClick: () => void;
|
|
5
5
|
};
|
|
6
|
-
export declare const useWorkflowActions: ({ possibleActions, assignee, taskId }: Pick<WorkflowTaskData, 'taskId' | 'possibleActions' | 'assignee'>) => {
|
|
6
|
+
export declare const useWorkflowActions: ({ possibleActions, assignee, taskId, isOpen }: Pick<WorkflowTaskData, 'taskId' | 'possibleActions' | 'assignee' | 'isOpen'>) => {
|
|
7
7
|
actions: TaskAction[];
|
|
8
8
|
actionRequestIsInProgress: boolean;
|
|
9
9
|
};
|
|
@@ -5,8 +5,9 @@ import mdmModule, { profile, ui } from '@reltio/mdm-module';
|
|
|
5
5
|
import { ViewIdContext } from '../../../contexts/ViewIdContext';
|
|
6
6
|
import { showWorkflowError } from '../helpers/errors';
|
|
7
7
|
import { WorkflowTasksContext } from '../../../contexts/WorkflowTasksContext';
|
|
8
|
+
import { isOpenTask } from '../helpers';
|
|
8
9
|
export var useWorkflowActions = function (_a) {
|
|
9
|
-
var possibleActions = _a.possibleActions, assignee = _a.assignee, taskId = _a.taskId;
|
|
10
|
+
var possibleActions = _a.possibleActions, assignee = _a.assignee, taskId = _a.taskId, isOpen = _a.isOpen;
|
|
10
11
|
var loadWorkflowTasks = (useContext(WorkflowTasksContext) || {}).loadWorkflowTasks;
|
|
11
12
|
var workflowPath = useSelector(mdmModule.selectors.getWorkflowPath);
|
|
12
13
|
var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
|
|
@@ -43,7 +44,7 @@ export var useWorkflowActions = function (_a) {
|
|
|
43
44
|
}
|
|
44
45
|
}; }, [workflowPath, taskId, environment, tenant, dispatch, entityUri, viewId, loadWorkflowTasks]);
|
|
45
46
|
var actions = useMemo(function () {
|
|
46
|
-
return username === assignee
|
|
47
|
+
return username === assignee && isOpenTask(isOpen)
|
|
47
48
|
? (possibleActions || []).map(function (_a) {
|
|
48
49
|
var action = _a.action, label = _a.label;
|
|
49
50
|
return ({
|
|
@@ -52,6 +53,6 @@ export var useWorkflowActions = function (_a) {
|
|
|
52
53
|
});
|
|
53
54
|
})
|
|
54
55
|
: [];
|
|
55
|
-
}, [possibleActions, performTaskAction, username, assignee]);
|
|
56
|
+
}, [possibleActions, performTaskAction, username, assignee, isOpen]);
|
|
56
57
|
return { actions: actions, actionRequestIsInProgress: actionRequestIsInProgress };
|
|
57
58
|
};
|
|
@@ -3,7 +3,7 @@ declare type AssigneeOption = {
|
|
|
3
3
|
label: string;
|
|
4
4
|
value: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const useWorkflowAssignee: ({ assignee, taskId }: Pick<WorkflowTaskData, 'taskId' | 'assignee'>) => {
|
|
6
|
+
export declare const useWorkflowAssignee: ({ assignee, taskId, isOpen }: Pick<WorkflowTaskData, 'taskId' | 'assignee' | 'isOpen'>) => {
|
|
7
7
|
assignee: AssigneeOption;
|
|
8
8
|
getAssignees: (text: any) => Promise<void | unknown[]>;
|
|
9
9
|
updateAssignee: (newValue: AssigneeOption) => void;
|
|
@@ -7,12 +7,13 @@ import { useSafePromise } from '../../../hooks';
|
|
|
7
7
|
import { WorkflowTasksContext } from '../../../contexts/WorkflowTasksContext';
|
|
8
8
|
import { showWorkflowError } from '../helpers/errors';
|
|
9
9
|
import { useWorkflowCheckPermission } from './useWorkflowCheckPermission';
|
|
10
|
+
import { isOpenTask } from '../helpers';
|
|
10
11
|
var assigneeToValue = function (assignee) { return ({
|
|
11
12
|
label: assignee,
|
|
12
13
|
value: assignee
|
|
13
14
|
}); };
|
|
14
15
|
export var useWorkflowAssignee = function (_a) {
|
|
15
|
-
var assignee = _a.assignee, taskId = _a.taskId;
|
|
16
|
+
var assignee = _a.assignee, taskId = _a.taskId, isOpen = _a.isOpen;
|
|
16
17
|
var updateTaskState = (useContext(WorkflowTasksContext) || {}).updateTaskState;
|
|
17
18
|
var workflowPath = useSelector(mdmModule.selectors.getWorkflowPath);
|
|
18
19
|
var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
|
|
@@ -23,7 +24,7 @@ export var useWorkflowAssignee = function (_a) {
|
|
|
23
24
|
var _c = useState(), assignees = _c[0], setAssignees = _c[1];
|
|
24
25
|
var _d = useState(false), updateRequestIsInProgress = _d[0], setUpdateRequestIsInProgress = _d[1];
|
|
25
26
|
var checkWorkflowPermission = useWorkflowCheckPermission();
|
|
26
|
-
var canUpdateTask = checkWorkflowPermission('UPDATE_TASK');
|
|
27
|
+
var canUpdateTask = checkWorkflowPermission('UPDATE_TASK') && isOpenTask(isOpen);
|
|
27
28
|
useEffect(function () {
|
|
28
29
|
setCurrentAssignee(assigneeToValue(assignee));
|
|
29
30
|
}, [assignee]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkflowTaskData } from '@reltio/mdm-sdk';
|
|
2
|
-
export declare const useWorkflowComments: ({ processInstanceComments, taskId }: WorkflowTaskData) => {
|
|
2
|
+
export declare const useWorkflowComments: ({ processInstanceComments, taskId, isOpen }: WorkflowTaskData) => {
|
|
3
3
|
comments: any[];
|
|
4
4
|
requestIsInProgress: boolean;
|
|
5
5
|
writeComment: (comment: any) => void;
|
|
@@ -6,8 +6,9 @@ import { useSafePromise } from '../../../hooks';
|
|
|
6
6
|
import { WorkflowTasksContext } from '../../../contexts/WorkflowTasksContext';
|
|
7
7
|
import { showWorkflowError } from '../helpers/errors';
|
|
8
8
|
import { useWorkflowCheckPermission } from './useWorkflowCheckPermission';
|
|
9
|
+
import { isOpenTask } from '../helpers';
|
|
9
10
|
export var useWorkflowComments = function (_a) {
|
|
10
|
-
var processInstanceComments = _a.processInstanceComments, taskId = _a.taskId;
|
|
11
|
+
var processInstanceComments = _a.processInstanceComments, taskId = _a.taskId, isOpen = _a.isOpen;
|
|
11
12
|
var updateTaskState = (useContext(WorkflowTasksContext) || {}).updateTaskState;
|
|
12
13
|
var workflowPath = useSelector(mdmModule.selectors.getWorkflowPath);
|
|
13
14
|
var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
|
|
@@ -16,7 +17,7 @@ export var useWorkflowComments = function (_a) {
|
|
|
16
17
|
var _b = useState([]), comments = _b[0], setComments = _b[1];
|
|
17
18
|
var _c = useState(false), requestIsInProgress = _c[0], setRequestIsInProgress = _c[1];
|
|
18
19
|
var checkWorkflowPermission = useWorkflowCheckPermission();
|
|
19
|
-
var canUpdateTask = checkWorkflowPermission('UPDATE_TASK');
|
|
20
|
+
var canUpdateTask = checkWorkflowPermission('UPDATE_TASK') && isOpenTask(isOpen);
|
|
20
21
|
useEffect(function () {
|
|
21
22
|
setComments(processInstanceComments || []);
|
|
22
23
|
}, [processInstanceComments]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkflowTaskData } from '@reltio/mdm-sdk';
|
|
2
|
-
export declare const useWorkflowDueDate: ({ dueDate, taskId }: Pick<WorkflowTaskData, 'dueDate' | 'taskId'>) => {
|
|
2
|
+
export declare const useWorkflowDueDate: ({ dueDate, taskId, isOpen }: Pick<WorkflowTaskData, 'dueDate' | 'taskId' | 'isOpen'>) => {
|
|
3
3
|
updateDueDate: (newValue: number) => void;
|
|
4
4
|
updateRequestIsInProgress: boolean;
|
|
5
5
|
readOnly: boolean;
|
|
@@ -6,8 +6,9 @@ import { useSafePromise } from '../../../hooks';
|
|
|
6
6
|
import { WorkflowTasksContext } from '../../../contexts/WorkflowTasksContext';
|
|
7
7
|
import { showWorkflowError } from '../helpers/errors';
|
|
8
8
|
import { useWorkflowCheckPermission } from './useWorkflowCheckPermission';
|
|
9
|
+
import { isOpenTask } from '../helpers';
|
|
9
10
|
export var useWorkflowDueDate = function (_a) {
|
|
10
|
-
var dueDate = _a.dueDate, taskId = _a.taskId;
|
|
11
|
+
var dueDate = _a.dueDate, taskId = _a.taskId, isOpen = _a.isOpen;
|
|
11
12
|
var updateTaskState = (useContext(WorkflowTasksContext) || {}).updateTaskState;
|
|
12
13
|
var workflowPath = useSelector(mdmModule.selectors.getWorkflowPath);
|
|
13
14
|
var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
|
|
@@ -15,7 +16,7 @@ export var useWorkflowDueDate = function (_a) {
|
|
|
15
16
|
var safePromise = useSafePromise();
|
|
16
17
|
var _b = useState(false), updateRequestIsInProgress = _b[0], setUpdateRequestIsInProgress = _b[1];
|
|
17
18
|
var checkWorkflowPermission = useWorkflowCheckPermission();
|
|
18
|
-
var canUpdateTask = checkWorkflowPermission('UPDATE_TASK');
|
|
19
|
+
var canUpdateTask = checkWorkflowPermission('UPDATE_TASK') && isOpenTask(isOpen);
|
|
19
20
|
var updateDueDate = useCallback(function (newValue) {
|
|
20
21
|
if (workflowPath && canUpdateTask && taskId && newValue && dueDate !== newValue) {
|
|
21
22
|
setUpdateRequestIsInProgress(true);
|
|
@@ -3,7 +3,7 @@ declare type PriorityOption = {
|
|
|
3
3
|
label: string;
|
|
4
4
|
value: number;
|
|
5
5
|
};
|
|
6
|
-
export declare const useWorkflowPriority: ({ priority, taskId }: Pick<WorkflowTaskData, 'taskId' | 'priority'>) => {
|
|
6
|
+
export declare const useWorkflowPriority: ({ priority, taskId, isOpen }: Pick<WorkflowTaskData, 'taskId' | 'priority' | 'isOpen'>) => {
|
|
7
7
|
priorities: PriorityOption[];
|
|
8
8
|
updatePriority: (newValue: PriorityOption) => void;
|
|
9
9
|
updateRequestIsInProgress: boolean;
|
|
@@ -7,8 +7,9 @@ import { useSafePromise } from '../../../hooks';
|
|
|
7
7
|
import { WorkflowTasksContext } from '../../../contexts/WorkflowTasksContext';
|
|
8
8
|
import { showWorkflowError } from '../helpers/errors';
|
|
9
9
|
import { useWorkflowCheckPermission } from './useWorkflowCheckPermission';
|
|
10
|
+
import { isOpenTask } from '../helpers';
|
|
10
11
|
export var useWorkflowPriority = function (_a) {
|
|
11
|
-
var priority = _a.priority, taskId = _a.taskId;
|
|
12
|
+
var priority = _a.priority, taskId = _a.taskId, isOpen = _a.isOpen;
|
|
12
13
|
var updateTaskState = (useContext(WorkflowTasksContext) || {}).updateTaskState;
|
|
13
14
|
var workflowPath = useSelector(mdmModule.selectors.getWorkflowPath);
|
|
14
15
|
var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
|
|
@@ -16,7 +17,7 @@ export var useWorkflowPriority = function (_a) {
|
|
|
16
17
|
var safePromise = useSafePromise();
|
|
17
18
|
var _b = useState(false), updateRequestIsInProgress = _b[0], setUpdateRequestIsInProgress = _b[1];
|
|
18
19
|
var checkWorkflowPermission = useWorkflowCheckPermission();
|
|
19
|
-
var canUpdateTask = checkWorkflowPermission('UPDATE_TASK');
|
|
20
|
+
var canUpdateTask = checkWorkflowPermission('UPDATE_TASK') && isOpenTask(isOpen);
|
|
20
21
|
var updatePriority = useCallback(function (newValue) {
|
|
21
22
|
var newPriority = newValue.value;
|
|
22
23
|
if (workflowPath && canUpdateTask && taskId && priority !== newPriority) {
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { WorkflowTaskData } from '@reltio/mdm-sdk';
|
|
2
|
-
|
|
2
|
+
declare type Config = {
|
|
3
|
+
processTypes?: string[];
|
|
4
|
+
assignee?: string;
|
|
5
|
+
showClosedTasks?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const useWorkflowTasks: (config?: Config) => {
|
|
3
8
|
tasks: WorkflowTaskData[];
|
|
4
9
|
total: number;
|
|
5
10
|
loading: boolean;
|
|
6
11
|
updateTaskState: (taskId: WorkflowTaskData['taskId'], payload: Partial<WorkflowTaskData>) => void;
|
|
7
12
|
loadWorkflowTasks: () => void;
|
|
8
13
|
};
|
|
14
|
+
export {};
|
|
@@ -11,11 +11,13 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { useCallback, useEffect, useState } from 'react';
|
|
13
13
|
import { useSelector } from 'react-redux';
|
|
14
|
+
import { filter, flatten, isNil, map, pipe, prop, reject, uniqBy } from 'ramda';
|
|
14
15
|
import mdmModule from '@reltio/mdm-module';
|
|
15
16
|
import { getTasksForEntity, isTempUri } from '@reltio/mdm-sdk';
|
|
16
|
-
import { useSafePromise } from '
|
|
17
|
-
import { useWorkflowCheckPermission } from '
|
|
18
|
-
export var useWorkflowTasks = function () {
|
|
17
|
+
import { useSafePromise } from '../../../hooks/useSafePromise';
|
|
18
|
+
import { useWorkflowCheckPermission } from './useWorkflowCheckPermission';
|
|
19
|
+
export var useWorkflowTasks = function (config) {
|
|
20
|
+
var _a = config || {}, processTypes = _a.processTypes, assignee = _a.assignee, showClosedTasks = _a.showClosedTasks;
|
|
19
21
|
var safePromise = useSafePromise();
|
|
20
22
|
var workflowPath = useSelector(mdmModule.selectors.getWorkflowPath);
|
|
21
23
|
var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
|
|
@@ -25,21 +27,27 @@ export var useWorkflowTasks = function () {
|
|
|
25
27
|
var checkWorkflowPermission = useWorkflowCheckPermission();
|
|
26
28
|
var canViewTasks = checkWorkflowPermission('VIEW_TASKS');
|
|
27
29
|
var enabled = !!(workflowPath && environment) && canViewTasks;
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
30
|
+
var _b = useState(null), tasks = _b[0], setTasks = _b[1];
|
|
31
|
+
var _c = useState(0), total = _c[0], setTotal = _c[1];
|
|
32
|
+
var _d = useState(false), loading = _d[0], setLoading = _d[1];
|
|
31
33
|
var loadWorkflowTasks = useCallback(function () {
|
|
32
34
|
setLoading(true);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
var parsedProcessTypes = !Array.isArray(processTypes) || processTypes.includes('*') ? null : processTypes;
|
|
36
|
+
var requests = (parsedProcessTypes || [null]).map(function (processType) {
|
|
37
|
+
return getTasksForEntity({
|
|
38
|
+
entityUri: entityUri,
|
|
39
|
+
workflowPath: workflowPath,
|
|
40
|
+
environment: environment,
|
|
41
|
+
tenant: tenant,
|
|
42
|
+
filter: { assignee: assignee, processType: processType },
|
|
43
|
+
includeClosed: !!showClosedTasks
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
safePromise(Promise.all(requests))
|
|
47
|
+
.then(function (responses) {
|
|
48
|
+
var tasks = pipe(map(prop('data')), reject(isNil), flatten, uniqBy(prop('taskId')), filter(isRequestedTask(parsedProcessTypes, assignee)))(responses);
|
|
49
|
+
setTasks(tasks);
|
|
50
|
+
setTotal(tasks.length);
|
|
43
51
|
})
|
|
44
52
|
.catch(function (error) {
|
|
45
53
|
console.warn('Workflow error', error);
|
|
@@ -47,7 +55,7 @@ export var useWorkflowTasks = function () {
|
|
|
47
55
|
.finally(function () {
|
|
48
56
|
setLoading(false);
|
|
49
57
|
});
|
|
50
|
-
}, [entityUri, environment, safePromise, tenant, workflowPath]);
|
|
58
|
+
}, [entityUri, environment, safePromise, tenant, workflowPath, assignee, showClosedTasks, processTypes]);
|
|
51
59
|
useEffect(function () {
|
|
52
60
|
if (entityUri && enabled && !isTempUri(entityUri)) {
|
|
53
61
|
loadWorkflowTasks();
|
|
@@ -63,3 +71,6 @@ export var useWorkflowTasks = function () {
|
|
|
63
71
|
}, []);
|
|
64
72
|
return { tasks: tasks, total: total, loading: loading, updateTaskState: updateTaskState, loadWorkflowTasks: loadWorkflowTasks };
|
|
65
73
|
};
|
|
74
|
+
var isRequestedTask = function (processTypes, assignee) { return function (task) {
|
|
75
|
+
return (!processTypes || processTypes.includes(task.processType)) && (!assignee || assignee === task.assignee);
|
|
76
|
+
}; };
|