@reltio/components 1.4.1642 → 1.4.1644
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/SidePanel/styles.js +2 -1
- package/cjs/components/workflow/components/AssigneeSelector/AssigneeSelector.d.ts +4 -1
- package/cjs/components/workflow/components/AssigneeSelector/AssigneeSelector.js +7 -5
- package/cjs/components/workflow/components/ReassignButton/ReassignButton.d.ts +7 -0
- package/cjs/components/workflow/components/ReassignButton/ReassignButton.js +47 -0
- package/cjs/components/workflow/components/ReassignButton/ReassignDialog.d.ts +8 -0
- package/cjs/components/workflow/components/ReassignButton/ReassignDialog.js +129 -0
- package/cjs/components/workflow/components/ReassignButton/styles.d.ts +1 -0
- package/cjs/components/workflow/components/ReassignButton/styles.js +27 -0
- package/cjs/components/workflow/hooks/useWorkflowAssignee.d.ts +5 -1
- package/cjs/components/workflow/hooks/useWorkflowAssignee.js +27 -12
- package/cjs/components/workflow/index.d.ts +1 -0
- package/cjs/components/workflow/index.js +3 -1
- package/cjs/contexts/MdmModuleContext/context.d.ts +4 -0
- package/cjs/contexts/MdmModuleContext/hooks.d.ts +5 -2
- package/cjs/contexts/MdmModuleContext/hooks.js +5 -1
- package/cjs/contexts/MdmModuleContext/index.d.ts +1 -1
- package/cjs/contexts/MdmModuleContext/index.js +2 -1
- package/cjs/hooks/index.d.ts +1 -0
- package/cjs/hooks/index.js +3 -1
- package/cjs/hooks/useExpandInvalidRelations.d.ts +1 -0
- package/cjs/hooks/useExpandInvalidRelations.js +56 -0
- package/cjs/icons/NegativeRuleIcon.d.ts +2 -2
- package/cjs/icons/NegativeRuleIcon.js +4 -4
- package/cjs/icons/NegativeRuleTooltipIcon.d.ts +2 -2
- package/cjs/icons/NegativeRuleTooltipIcon.js +4 -4
- package/cjs/icons/Reassign.d.ts +3 -0
- package/cjs/icons/Reassign.js +22 -0
- package/cjs/icons/index.d.ts +1 -0
- package/cjs/icons/index.js +4 -2
- package/esm/components/SidePanel/styles.js +2 -1
- package/esm/components/workflow/components/AssigneeSelector/AssigneeSelector.d.ts +4 -1
- package/esm/components/workflow/components/AssigneeSelector/AssigneeSelector.js +7 -5
- package/esm/components/workflow/components/ReassignButton/ReassignButton.d.ts +7 -0
- package/esm/components/workflow/components/ReassignButton/ReassignButton.js +19 -0
- package/esm/components/workflow/components/ReassignButton/ReassignDialog.d.ts +8 -0
- package/esm/components/workflow/components/ReassignButton/ReassignDialog.js +101 -0
- package/esm/components/workflow/components/ReassignButton/styles.d.ts +1 -0
- package/esm/components/workflow/components/ReassignButton/styles.js +24 -0
- package/esm/components/workflow/hooks/useWorkflowAssignee.d.ts +5 -1
- package/esm/components/workflow/hooks/useWorkflowAssignee.js +27 -12
- package/esm/components/workflow/index.d.ts +1 -0
- package/esm/components/workflow/index.js +1 -0
- package/esm/contexts/MdmModuleContext/context.d.ts +4 -0
- package/esm/contexts/MdmModuleContext/hooks.d.ts +5 -2
- package/esm/contexts/MdmModuleContext/hooks.js +4 -1
- package/esm/contexts/MdmModuleContext/index.d.ts +1 -1
- package/esm/contexts/MdmModuleContext/index.js +1 -1
- package/esm/hooks/index.d.ts +1 -0
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/useExpandInvalidRelations.d.ts +1 -0
- package/esm/hooks/useExpandInvalidRelations.js +52 -0
- package/esm/icons/NegativeRuleIcon.d.ts +2 -2
- package/esm/icons/NegativeRuleIcon.js +4 -4
- package/esm/icons/NegativeRuleTooltipIcon.d.ts +2 -2
- package/esm/icons/NegativeRuleTooltipIcon.js +4 -4
- package/esm/icons/Reassign.d.ts +3 -0
- package/esm/icons/Reassign.js +17 -0
- package/esm/icons/index.d.ts +1 -0
- package/esm/icons/index.js +1 -0
- package/package.json +2 -2
|
@@ -12,6 +12,7 @@ exports.useStyles = (0, styles_1.makeStyles)(function (theme) { return ({
|
|
|
12
12
|
boxShadow: '0 1px 1px 0 rgba(0,0,0,0.14), 0 2px 1px -1px rgba(0,0,0,0.12), 0 1px 3px 0 rgba(0,0,0,0.2)',
|
|
13
13
|
transition: theme.transitions.create(['width'], {
|
|
14
14
|
duration: theme.transitions.duration.enteringScreen
|
|
15
|
-
})
|
|
15
|
+
}),
|
|
16
|
+
height: '100%'
|
|
16
17
|
}
|
|
17
18
|
}); });
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { WorkflowTaskData } from '@reltio/mdm-sdk';
|
|
3
3
|
type Props = Pick<WorkflowTaskData, 'taskId' | 'assignee'> & {
|
|
4
4
|
isTaskOpen?: WorkflowTaskData['isOpen'];
|
|
5
|
+
label?: string;
|
|
6
|
+
onChange?: (assignee: any) => void;
|
|
7
|
+
showCurrentAssignee?: boolean;
|
|
5
8
|
};
|
|
6
|
-
declare const AssigneeSelector: ({ taskId, assignee, isTaskOpen }: Props) => JSX.Element;
|
|
9
|
+
declare const AssigneeSelector: ({ taskId, assignee, isTaskOpen, label, onChange, showCurrentAssignee }: Props) => JSX.Element;
|
|
7
10
|
export default AssigneeSelector;
|
|
@@ -8,13 +8,15 @@ var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
|
8
8
|
var DropDownSelector_1 = __importDefault(require("../../../DropDownSelector/DropDownSelector"));
|
|
9
9
|
var useWorkflowAssignee_1 = require("../../hooks/useWorkflowAssignee");
|
|
10
10
|
var AssigneeSelector = function (_a) {
|
|
11
|
-
var taskId = _a.taskId, assignee = _a.assignee, isTaskOpen = _a.isTaskOpen;
|
|
12
|
-
var
|
|
11
|
+
var taskId = _a.taskId, assignee = _a.assignee, isTaskOpen = _a.isTaskOpen, label = _a.label, onChange = _a.onChange, _b = _a.showCurrentAssignee, showCurrentAssignee = _b === void 0 ? true : _b;
|
|
12
|
+
var _c = (0, useWorkflowAssignee_1.useWorkflowAssignee)({
|
|
13
13
|
taskId: taskId,
|
|
14
14
|
assignee: assignee,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
showCurrentAssignee: showCurrentAssignee,
|
|
16
|
+
isOpen: isTaskOpen,
|
|
17
|
+
onChange: onChange
|
|
18
|
+
}), currentAssignee = _c.assignee, getAssignees = _c.getAssignees, updateAssignee = _c.updateAssignee, updateRequestIsInProgress = _c.updateRequestIsInProgress, readOnly = _c.readOnly;
|
|
17
19
|
var disabled = updateRequestIsInProgress || readOnly;
|
|
18
|
-
return (react_1.default.createElement(DropDownSelector_1.default, { isDisabled: disabled, getOptions: getAssignees, onChange: updateAssignee, hideSelectedOptions: false, label: ui_i18n_1.default.text('Assigned to'), value: currentAssignee, defaultOptions: true, TextFieldProps: { disabled: disabled }, height: 40 }));
|
|
20
|
+
return (react_1.default.createElement(DropDownSelector_1.default, { isDisabled: disabled, getOptions: getAssignees, onChange: updateAssignee, hideSelectedOptions: false, label: label || ui_i18n_1.default.text('Assigned to'), value: currentAssignee, defaultOptions: true, TextFieldProps: { disabled: disabled }, height: 40 }));
|
|
19
21
|
};
|
|
20
22
|
exports.default = AssigneeSelector;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
var react_1 = __importStar(require("react"));
|
|
30
|
+
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
31
|
+
var SmallIconButton_1 = require("../../../SmallIconButton");
|
|
32
|
+
var Reassign_1 = __importDefault(require("../../../../icons/Reassign"));
|
|
33
|
+
var ReassignDialog_1 = __importDefault(require("./ReassignDialog"));
|
|
34
|
+
var ReassignButton = function (_a) {
|
|
35
|
+
var disabled = _a.disabled, changeRequestURI = _a.changeRequestURI;
|
|
36
|
+
var _b = (0, react_1.useState)(false), isDialogOpen = _b[0], setIsDialogOpen = _b[1];
|
|
37
|
+
var handleOpenDialog = function () {
|
|
38
|
+
setIsDialogOpen(true);
|
|
39
|
+
};
|
|
40
|
+
var handleCloseDialog = function () {
|
|
41
|
+
setIsDialogOpen(false);
|
|
42
|
+
};
|
|
43
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
44
|
+
react_1.default.createElement(SmallIconButton_1.SmallIconButtonWithTooltip, { "data-reltio-id": "reltio-reassign-button", showForDisabled: true, tooltipTitle: ui_i18n_1.default.text('Reassign task'), "aria-label": ui_i18n_1.default.text('Reassign task'), icon: Reassign_1.default, onClick: handleOpenDialog, size: "L", disabled: disabled || !changeRequestURI }),
|
|
45
|
+
react_1.default.createElement(ReassignDialog_1.default, { isOpen: isDialogOpen, onClose: handleCloseDialog, changeRequestURI: changeRequestURI })));
|
|
46
|
+
};
|
|
47
|
+
exports.default = ReassignButton;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
var react_1 = __importStar(require("react"));
|
|
41
|
+
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
42
|
+
var Button_1 = __importDefault(require("@mui/material/Button"));
|
|
43
|
+
var Dialog_1 = __importDefault(require("@mui/material/Dialog"));
|
|
44
|
+
var DialogActions_1 = __importDefault(require("@mui/material/DialogActions"));
|
|
45
|
+
var DialogContent_1 = __importDefault(require("@mui/material/DialogContent"));
|
|
46
|
+
var DialogTitle_1 = __importDefault(require("@mui/material/DialogTitle"));
|
|
47
|
+
var Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
48
|
+
var Divider_1 = __importDefault(require("@mui/material/Divider"));
|
|
49
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
50
|
+
var AssigneeSelector_1 = __importDefault(require("../../components/AssigneeSelector/AssigneeSelector"));
|
|
51
|
+
var useWorkflowAssignee_1 = require("../../hooks/useWorkflowAssignee");
|
|
52
|
+
var hooks_1 = require("../../../../hooks");
|
|
53
|
+
var contexts_1 = require("../../../../contexts");
|
|
54
|
+
var LinearLoadIndicator_1 = __importDefault(require("../../../../components/LinearLoadIndicator/LinearLoadIndicator"));
|
|
55
|
+
var errors_1 = require("../../helpers/errors");
|
|
56
|
+
var styles_1 = require("./styles");
|
|
57
|
+
var ReassignDialog = function (_a) {
|
|
58
|
+
var isOpen = _a.isOpen, onClose = _a.onClose, changeRequestURI = _a.changeRequestURI;
|
|
59
|
+
var styles = (0, styles_1.useStyles)();
|
|
60
|
+
var workflowPath = (0, contexts_1.useMdmWorkflowPath)();
|
|
61
|
+
var environment = (0, contexts_1.useMdmWorkflowEnvironmentUrl)();
|
|
62
|
+
var tenant = (0, contexts_1.useMdmTenant)();
|
|
63
|
+
var _b = (0, react_1.useState)(null), task = _b[0], setTask = _b[1];
|
|
64
|
+
var _c = (0, react_1.useState)(false), loading = _c[0], setLoading = _c[1];
|
|
65
|
+
var safePromise = (0, hooks_1.useSafePromise)();
|
|
66
|
+
var _d = task || {}, currentAssignee = _d.assignee, taskId = _d.taskId;
|
|
67
|
+
var _e = (0, react_1.useState)(null), assignee = _e[0], setAssignee = _e[1];
|
|
68
|
+
var handleClose = function () {
|
|
69
|
+
setAssignee(null);
|
|
70
|
+
onClose();
|
|
71
|
+
};
|
|
72
|
+
var readOnly = (0, useWorkflowAssignee_1.useWorkflowAssignee)({
|
|
73
|
+
taskId: taskId,
|
|
74
|
+
assignee: '',
|
|
75
|
+
isOpen: task === null || task === void 0 ? void 0 : task.isOpen
|
|
76
|
+
}).readOnly;
|
|
77
|
+
var handleReassign = function () {
|
|
78
|
+
if (!readOnly) {
|
|
79
|
+
setLoading(true);
|
|
80
|
+
(0, mdm_sdk_1.updateAssigneeForTask)({
|
|
81
|
+
taskId: taskId,
|
|
82
|
+
workflowPath: workflowPath,
|
|
83
|
+
environment: environment,
|
|
84
|
+
tenant: tenant,
|
|
85
|
+
assignee: assignee
|
|
86
|
+
})
|
|
87
|
+
.then(function () {
|
|
88
|
+
setTask(__assign(__assign({}, task), { assignee: assignee }));
|
|
89
|
+
handleClose();
|
|
90
|
+
})
|
|
91
|
+
.catch(errors_1.showWorkflowError)
|
|
92
|
+
.finally(function () {
|
|
93
|
+
setLoading(false);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
(0, react_1.useEffect)(function () {
|
|
98
|
+
if (changeRequestURI) {
|
|
99
|
+
setLoading(true);
|
|
100
|
+
safePromise((0, mdm_sdk_1.getTasksForEntity)({
|
|
101
|
+
entityUri: changeRequestURI,
|
|
102
|
+
workflowPath: workflowPath,
|
|
103
|
+
environment: environment,
|
|
104
|
+
tenant: tenant,
|
|
105
|
+
includeClosed: false
|
|
106
|
+
}))
|
|
107
|
+
.then(function (response) {
|
|
108
|
+
var tasks = response.data;
|
|
109
|
+
setTask(tasks ? tasks[0] : null);
|
|
110
|
+
})
|
|
111
|
+
.finally(function () {
|
|
112
|
+
setLoading(false);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}, [changeRequestURI, environment, safePromise, tenant, workflowPath]);
|
|
116
|
+
return (react_1.default.createElement(Dialog_1.default, { open: isOpen, onClose: handleClose },
|
|
117
|
+
react_1.default.createElement(DialogTitle_1.default, null, ui_i18n_1.default.text('Reassign task')),
|
|
118
|
+
react_1.default.createElement(DialogContent_1.default, { className: styles.dialogContent },
|
|
119
|
+
loading && react_1.default.createElement(LinearLoadIndicator_1.default, null),
|
|
120
|
+
react_1.default.createElement("div", { className: styles.dialogText },
|
|
121
|
+
react_1.default.createElement(Typography_1.default, { className: styles.caption }, ui_i18n_1.default.text('Assigned to')),
|
|
122
|
+
react_1.default.createElement(Typography_1.default, { className: styles.currentAssignee }, currentAssignee)),
|
|
123
|
+
!readOnly && (react_1.default.createElement(AssigneeSelector_1.default, { taskId: taskId, isTaskOpen: isOpen, label: ui_i18n_1.default.text('Reassign to'), assignee: currentAssignee, showCurrentAssignee: false, onChange: setAssignee }))),
|
|
124
|
+
react_1.default.createElement(Divider_1.default, null),
|
|
125
|
+
react_1.default.createElement(DialogActions_1.default, null,
|
|
126
|
+
react_1.default.createElement(Button_1.default, { onClick: handleClose }, ui_i18n_1.default.text('Cancel')),
|
|
127
|
+
react_1.default.createElement(Button_1.default, { color: "primary", onClick: handleReassign, disabled: readOnly || !assignee || loading }, ui_i18n_1.default.text('Reassign')))));
|
|
128
|
+
};
|
|
129
|
+
exports.default = ReassignDialog;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"caption" | "title" | "disabled" | "currentAssignee" | "dialogText" | "dialogContent">;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
var styles_1 = require("@mui/styles");
|
|
5
|
+
exports.useStyles = (0, styles_1.makeStyles)(function (theme) { return ({
|
|
6
|
+
caption: {
|
|
7
|
+
fontSize: '12px',
|
|
8
|
+
color: theme.palette.text.secondary
|
|
9
|
+
},
|
|
10
|
+
currentAssignee: {
|
|
11
|
+
fontSize: '14px',
|
|
12
|
+
color: theme.palette.text.primary
|
|
13
|
+
},
|
|
14
|
+
dialogText: {
|
|
15
|
+
marginBottom: '16px'
|
|
16
|
+
},
|
|
17
|
+
title: {
|
|
18
|
+
padding: '12px 24px'
|
|
19
|
+
},
|
|
20
|
+
dialogContent: {
|
|
21
|
+
paddingTop: '0px',
|
|
22
|
+
minWidth: '500px'
|
|
23
|
+
},
|
|
24
|
+
disabled: {
|
|
25
|
+
fill: theme.palette.text.disabled
|
|
26
|
+
}
|
|
27
|
+
}); });
|
|
@@ -3,7 +3,11 @@ type AssigneeOption = {
|
|
|
3
3
|
label: string;
|
|
4
4
|
value: string;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
type Props = Partial<Pick<WorkflowTaskData, 'taskId' | 'assignee' | 'isOpen'>> & {
|
|
7
|
+
onChange?: (assignee: any) => void;
|
|
8
|
+
showCurrentAssignee?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const useWorkflowAssignee: ({ assignee, showCurrentAssignee, taskId, isOpen, onChange }: Props) => {
|
|
7
11
|
assignee: AssigneeOption;
|
|
8
12
|
getAssignees: (text: any) => Promise<void | AssigneeOption[]>;
|
|
9
13
|
updateAssignee: (newValue: AssigneeOption) => void;
|
|
@@ -14,20 +14,20 @@ var assigneeToValue = function (assignee) { return ({
|
|
|
14
14
|
value: assignee
|
|
15
15
|
}); };
|
|
16
16
|
var useWorkflowAssignee = function (_a) {
|
|
17
|
-
var assignee = _a.assignee, taskId = _a.taskId, isOpen = _a.isOpen;
|
|
17
|
+
var assignee = _a.assignee, _b = _a.showCurrentAssignee, showCurrentAssignee = _b === void 0 ? true : _b, taskId = _a.taskId, isOpen = _a.isOpen, onChange = _a.onChange;
|
|
18
18
|
var updateTaskState = ((0, react_1.useContext)(contexts_1.WorkflowTasksContext) || {}).updateTaskState;
|
|
19
19
|
var workflowPath = (0, contexts_1.useMdmWorkflowPath)();
|
|
20
20
|
var environment = (0, contexts_1.useMdmWorkflowEnvironmentUrl)();
|
|
21
21
|
var tenant = (0, contexts_1.useMdmTenant)();
|
|
22
22
|
var updateSafePromise = (0, hooks_1.useSafePromise)();
|
|
23
23
|
var getSafePromise = (0, hooks_1.useSafePromise)();
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
24
|
+
var _c = (0, react_1.useState)(null), currentAssignee = _c[0], setCurrentAssignee = _c[1];
|
|
25
|
+
var _d = (0, react_1.useState)(), assignees = _d[0], setAssignees = _d[1];
|
|
26
|
+
var _e = (0, react_1.useState)(false), updateRequestIsInProgress = _e[0], setUpdateRequestIsInProgress = _e[1];
|
|
27
27
|
var checkWorkflowPermission = (0, useWorkflowCheckPermission_1.useWorkflowCheckPermission)();
|
|
28
28
|
var canUpdateTask = checkWorkflowPermission('UPDATE_TASK') && (0, helpers_1.isOpenTask)(isOpen);
|
|
29
29
|
(0, react_1.useEffect)(function () {
|
|
30
|
-
setCurrentAssignee(assigneeToValue(assignee));
|
|
30
|
+
showCurrentAssignee && setCurrentAssignee(assigneeToValue(assignee));
|
|
31
31
|
}, [assignee]);
|
|
32
32
|
var getAssignees = (0, react_1.useCallback)(function (text) {
|
|
33
33
|
if (workflowPath && canUpdateTask && taskId) {
|
|
@@ -44,6 +44,7 @@ var useWorkflowAssignee = function (_a) {
|
|
|
44
44
|
.then(function (result) {
|
|
45
45
|
var data = result.data;
|
|
46
46
|
var assignees = data
|
|
47
|
+
.filter(function (a) { return (showCurrentAssignee ? true : a !== assignee); })
|
|
47
48
|
.sort(function (a, b) {
|
|
48
49
|
return mdm_sdk_1.utils.strings.sort('asc', a, b);
|
|
49
50
|
})
|
|
@@ -55,21 +56,35 @@ var useWorkflowAssignee = function (_a) {
|
|
|
55
56
|
}
|
|
56
57
|
},
|
|
57
58
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
-
[
|
|
59
|
+
[
|
|
60
|
+
workflowPath,
|
|
61
|
+
taskId,
|
|
62
|
+
environment,
|
|
63
|
+
tenant,
|
|
64
|
+
assignees,
|
|
65
|
+
setAssignees,
|
|
66
|
+
canUpdateTask,
|
|
67
|
+
assignee,
|
|
68
|
+
showCurrentAssignee
|
|
69
|
+
]);
|
|
59
70
|
var updateAssignee = (0, react_1.useCallback)(function (newValue) {
|
|
60
|
-
|
|
61
|
-
|
|
71
|
+
var assignee = newValue.value;
|
|
72
|
+
if (onChange) {
|
|
73
|
+
setCurrentAssignee(assigneeToValue(assignee));
|
|
74
|
+
onChange(assignee);
|
|
75
|
+
}
|
|
76
|
+
if (!onChange && workflowPath && canUpdateTask && taskId) {
|
|
62
77
|
setUpdateRequestIsInProgress(true);
|
|
63
78
|
updateSafePromise((0, mdm_sdk_1.updateAssigneeForTask)({
|
|
64
79
|
taskId: taskId,
|
|
65
80
|
workflowPath: workflowPath,
|
|
66
81
|
environment: environment,
|
|
67
82
|
tenant: tenant,
|
|
68
|
-
assignee:
|
|
83
|
+
assignee: assignee
|
|
69
84
|
}))
|
|
70
85
|
.then(function () {
|
|
71
|
-
setCurrentAssignee(assigneeToValue(
|
|
72
|
-
updateTaskState === null || updateTaskState === void 0 ? void 0 : updateTaskState(taskId, { assignee:
|
|
86
|
+
setCurrentAssignee(assigneeToValue(assignee));
|
|
87
|
+
updateTaskState === null || updateTaskState === void 0 ? void 0 : updateTaskState(taskId, { assignee: assignee });
|
|
73
88
|
})
|
|
74
89
|
.catch(errors_1.showWorkflowError)
|
|
75
90
|
.finally(function () {
|
|
@@ -78,7 +93,7 @@ var useWorkflowAssignee = function (_a) {
|
|
|
78
93
|
}
|
|
79
94
|
},
|
|
80
95
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
81
|
-
[workflowPath, taskId, environment, tenant, canUpdateTask]);
|
|
96
|
+
[workflowPath, taskId, environment, tenant, canUpdateTask, onChange]);
|
|
82
97
|
return {
|
|
83
98
|
assignee: currentAssignee,
|
|
84
99
|
getAssignees: getAssignees,
|
|
@@ -2,6 +2,7 @@ export { WorkflowTaskCard } from './cards/WorkflowTaskCard';
|
|
|
2
2
|
export { AddWorkflowButton } from './components/AddWorkflowButton/AddWorkflowButton';
|
|
3
3
|
export { default as TaskActions } from './components/TaskActions/TaskActions';
|
|
4
4
|
export { default as AssigneeSelector } from './components/AssigneeSelector/AssigneeSelector';
|
|
5
|
+
export { default as ReassignButton } from './components/ReassignButton/ReassignButton';
|
|
5
6
|
export { default as WorkflowComments } from './components/WorkflowComments';
|
|
6
7
|
export { useWorkflowAssignee } from './hooks/useWorkflowAssignee';
|
|
7
8
|
export { useWorkflowComments } from './hooks/useWorkflowComments';
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useWorkflowDefaultActionSuccessHandler = exports.TaskActionButtons = exports.useWorkflowTasks = exports.useWorkflowCheckPermission = exports.useWorkflowActions = exports.useWorkflowComments = exports.useWorkflowAssignee = exports.WorkflowComments = exports.AssigneeSelector = exports.TaskActions = exports.AddWorkflowButton = exports.WorkflowTaskCard = void 0;
|
|
6
|
+
exports.useWorkflowDefaultActionSuccessHandler = exports.TaskActionButtons = exports.useWorkflowTasks = exports.useWorkflowCheckPermission = exports.useWorkflowActions = exports.useWorkflowComments = exports.useWorkflowAssignee = exports.WorkflowComments = exports.ReassignButton = exports.AssigneeSelector = exports.TaskActions = exports.AddWorkflowButton = exports.WorkflowTaskCard = void 0;
|
|
7
7
|
var WorkflowTaskCard_1 = require("./cards/WorkflowTaskCard");
|
|
8
8
|
Object.defineProperty(exports, "WorkflowTaskCard", { enumerable: true, get: function () { return WorkflowTaskCard_1.WorkflowTaskCard; } });
|
|
9
9
|
var AddWorkflowButton_1 = require("./components/AddWorkflowButton/AddWorkflowButton");
|
|
@@ -12,6 +12,8 @@ var TaskActions_1 = require("./components/TaskActions/TaskActions");
|
|
|
12
12
|
Object.defineProperty(exports, "TaskActions", { enumerable: true, get: function () { return __importDefault(TaskActions_1).default; } });
|
|
13
13
|
var AssigneeSelector_1 = require("./components/AssigneeSelector/AssigneeSelector");
|
|
14
14
|
Object.defineProperty(exports, "AssigneeSelector", { enumerable: true, get: function () { return __importDefault(AssigneeSelector_1).default; } });
|
|
15
|
+
var ReassignButton_1 = require("./components/ReassignButton/ReassignButton");
|
|
16
|
+
Object.defineProperty(exports, "ReassignButton", { enumerable: true, get: function () { return __importDefault(ReassignButton_1).default; } });
|
|
15
17
|
var WorkflowComments_1 = require("./components/WorkflowComments");
|
|
16
18
|
Object.defineProperty(exports, "WorkflowComments", { enumerable: true, get: function () { return __importDefault(WorkflowComments_1).default; } });
|
|
17
19
|
var useWorkflowAssignee_1 = require("./hooks/useWorkflowAssignee");
|
|
@@ -113,12 +113,14 @@ export type MdmModuleActionsContextProps = Partial<{
|
|
|
113
113
|
setInitialInfo: (id: string, relationUri: string, tempEntity: Entity, connection: Connection) => void;
|
|
114
114
|
setRelationType: (id: string, relationUri: string, relationType: CompactRelationType) => void;
|
|
115
115
|
closeRelationEditor: (id: string, relationUri: string) => void;
|
|
116
|
+
openRelationEditor: (id: string, connection: Connection) => void;
|
|
116
117
|
setRelationEntity: (id: string, relationUri: string, entityInfo: Entity) => void;
|
|
117
118
|
errorsSet: (payload: AttributeError[]) => void;
|
|
118
119
|
addRelation: (id: string, connection: Connection) => void;
|
|
119
120
|
editRelation: (id: string, connection: Connection) => void;
|
|
120
121
|
}>;
|
|
121
122
|
export type MdmModuleListenersContextProps = Partial<{
|
|
123
|
+
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
122
124
|
searchNavigationListener: (action: AnyAction, state: any, dispatch: (action: AnyAction) => void) => void;
|
|
123
125
|
}>;
|
|
124
126
|
export declare const MdmModuleActionsContext: import("@fluentui/react-context-selector").Context<Partial<{
|
|
@@ -182,6 +184,7 @@ export declare const MdmModuleActionsContext: import("@fluentui/react-context-se
|
|
|
182
184
|
setInitialInfo: (id: string, relationUri: string, tempEntity: Entity, connection: Connection) => void;
|
|
183
185
|
setRelationType: (id: string, relationUri: string, relationType: CompactRelationType) => void;
|
|
184
186
|
closeRelationEditor: (id: string, relationUri: string) => void;
|
|
187
|
+
openRelationEditor: (id: string, connection: Connection) => void;
|
|
185
188
|
setRelationEntity: (id: string, relationUri: string, entityInfo: Entity) => void;
|
|
186
189
|
errorsSet: (payload: AttributeError[]) => void;
|
|
187
190
|
addRelation: (id: string, connection: Connection) => void;
|
|
@@ -240,5 +243,6 @@ export declare const MdmModuleValuesContext: import("@fluentui/react-context-sel
|
|
|
240
243
|
isCollaborationEnabled: boolean;
|
|
241
244
|
}>>;
|
|
242
245
|
export declare const MdmModuleListenersContext: import("@fluentui/react-context-selector").Context<Partial<{
|
|
246
|
+
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
243
247
|
searchNavigationListener: (action: AnyAction, state: any, dispatch: (action: AnyAction) => void) => void;
|
|
244
248
|
}>>;
|
|
@@ -61,6 +61,7 @@ export declare const useMdmDependentLookupEditorState: (valueUri: string) => {
|
|
|
61
61
|
export declare const useMdmActiveErrorsForAttributesPager: (parentUri: string, attributeType: AttributeType) => import("@reltio/mdm-sdk").AttributeError[];
|
|
62
62
|
export declare const useMdmDependentLookupsStructureNode: (attributeTypeUri: string) => import("@reltio/mdm-sdk").DependentLookupsStructureNode;
|
|
63
63
|
export declare const useMdmAllRelationsToAddAndEdit: (viewIds?: string[]) => import("@reltio/mdm-sdk").Connection[];
|
|
64
|
+
export declare const useMdmRelationsDrafts: (viewId: string) => import("@reltio/mdm-sdk").ConnectionDrafts;
|
|
64
65
|
export declare const useMdmDependentLookupEditorContext: (attributeValue: SimpleAttributeValue, attributeType: AttributeType) => {
|
|
65
66
|
parents: import("@reltio/mdm-sdk").DependentLookupsParentForApi[];
|
|
66
67
|
disabled: boolean;
|
|
@@ -68,7 +69,7 @@ export declare const useMdmDependentLookupEditorContext: (attributeValue: Simple
|
|
|
68
69
|
value?: null;
|
|
69
70
|
};
|
|
70
71
|
export declare const useMdmGlobalSearchRequestOptions: (omittingFields?: string[]) => import("@reltio/mdm-sdk").GlobalSearchRequestOptions;
|
|
71
|
-
export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent" | "openConsoleApp" | "addAttributes" | "modifyAttribute" | "removeAttribute" | "entityDeleted" | "entityCreated" | "errorDeactivated" | "requestNextPageOfAttributeValues" | "openEntity" | "setDefaultProfilePicForModifiedEntity" | "setDefaultProfilePicForEntity" | "dependentLookupsEditorTouched" | "openPivotingPerspective" | "lookupsLoaded" | "lookupsForTypeResolved" | "errorSet" | "setHistoryMode" | "modeUpdated" | "setHistoryEvent" | "clearHistoryEvent" | "setHistoryDiff" | "setHistorySlice" | "updateSearchNavigationDataFields" | "openPerspective" | "entityDeletionFinished" | "loadEntity" | "updateSearchNavigationDataOnMerge" | "lookupsListResolved" | "relationsLoaded" | "setInitialInfo" | "setRelationType" | "closeRelationEditor" | "setRelationEntity" | "errorsSet" | "addRelation" | "editRelation">(action: T) => Partial<{
|
|
72
|
+
export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent" | "openConsoleApp" | "addAttributes" | "modifyAttribute" | "removeAttribute" | "entityDeleted" | "entityCreated" | "errorDeactivated" | "requestNextPageOfAttributeValues" | "openEntity" | "setDefaultProfilePicForModifiedEntity" | "setDefaultProfilePicForEntity" | "dependentLookupsEditorTouched" | "openPivotingPerspective" | "lookupsLoaded" | "lookupsForTypeResolved" | "errorSet" | "setHistoryMode" | "modeUpdated" | "setHistoryEvent" | "clearHistoryEvent" | "setHistoryDiff" | "setHistorySlice" | "updateSearchNavigationDataFields" | "openPerspective" | "entityDeletionFinished" | "loadEntity" | "updateSearchNavigationDataOnMerge" | "lookupsListResolved" | "relationsLoaded" | "setInitialInfo" | "setRelationType" | "closeRelationEditor" | "openRelationEditor" | "setRelationEntity" | "errorsSet" | "addRelation" | "editRelation">(action: T) => Partial<{
|
|
72
73
|
openSearch: (payload: import("@reltio/mdm-sdk").SearchState) => void;
|
|
73
74
|
openHistoryEvent: (payload: {
|
|
74
75
|
entityUri: string;
|
|
@@ -129,11 +130,13 @@ export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent"
|
|
|
129
130
|
setInitialInfo: (id: string, relationUri: string, tempEntity: import("@reltio/mdm-sdk").Entity, connection: import("@reltio/mdm-sdk").Connection) => void;
|
|
130
131
|
setRelationType: (id: string, relationUri: string, relationType: import("@reltio/mdm-sdk").CompactRelationType) => void;
|
|
131
132
|
closeRelationEditor: (id: string, relationUri: string) => void;
|
|
133
|
+
openRelationEditor: (id: string, connection: import("@reltio/mdm-sdk").Connection) => void;
|
|
132
134
|
setRelationEntity: (id: string, relationUri: string, entityInfo: import("@reltio/mdm-sdk").Entity) => void;
|
|
133
135
|
errorsSet: (payload: import("@reltio/mdm-sdk").AttributeError[]) => void;
|
|
134
136
|
addRelation: (id: string, connection: import("@reltio/mdm-sdk").Connection) => void;
|
|
135
137
|
editRelation: (id: string, connection: import("@reltio/mdm-sdk").Connection) => void;
|
|
136
138
|
}>[T];
|
|
137
|
-
export declare const useMdmListener: <T extends "searchNavigationListener">(listener: T) => Partial<{
|
|
139
|
+
export declare const useMdmListener: <T extends "expandInvalidRelatonsListener" | "searchNavigationListener">(listener: T) => Partial<{
|
|
140
|
+
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
138
141
|
searchNavigationListener: (action: import("../..").AnyAction, state: any, dispatch: (action: import("../..").AnyAction) => void) => void;
|
|
139
142
|
}>[T];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMdmIsWorkflowEnabled = exports.useMdmIsCollaborationEnabled = exports.useMdmSearchProviderData = exports.useMdmSearchNavigationData = exports.useMdmDataTenants = exports.useMdmEnvironment = exports.useMdmTenantName = exports.useMdmTenant = exports.useMdmTenantObject = exports.useMdmUserRoles = exports.useMdmUsername = exports.useMdmUser = exports.useMdmMetadata = exports.useMdmDependentLookups = exports.useMdmLookups = exports.useMdmProfileLastLoadedTime = exports.useMdmHistoryEvent = exports.useMdmHistorySlice = exports.useMdmHistoryMode = exports.useMdmHistoryDiff = exports.useMdmIsEditableMode = exports.useMdmIsViewMode = exports.useMdmMode = exports.useMdmEntityUriWithDataTenant = exports.useMdmEntityWithDiff = exports.useMdmEntityUri = exports.useMdmEntity = exports.useMdmModifiedEntities = exports.useMdmLookupAutocomplete = exports.useMdmAttributesSortingStrategy = exports.useMdmDefaultMaxValues = exports.useMdmAttributePresentations = exports.useMdmDateTimeMask = exports.useMdmDateMask = exports.useMdmPivotingAttributes = exports.useMdmShowEntityId = exports.useMdmImageAttributesFieldsOrder = exports.useMdmCollaborationPath = exports.useMdmApiPath = exports.useMdmReltioPath = exports.useMdmImageServicePath = exports.useMdmWorkflowPath = exports.useMdmServicesPath = exports.useMdmDtssPath = exports.useMdmUiPath = exports.useMdmAbsoluteImagePath = exports.useMdmExportPath = exports.useMdmWorkflowEnvironmentUrl = exports.useMdmUiError = exports.useMdmAutoCloseInterval = void 0;
|
|
4
|
-
exports.useMdmListener = exports.useMdmAction = exports.useMdmGlobalSearchRequestOptions = exports.useMdmDependentLookupEditorContext = exports.useMdmAllRelationsToAddAndEdit = exports.useMdmDependentLookupsStructureNode = exports.useMdmActiveErrorsForAttributesPager = exports.useMdmDependentLookupEditorState = exports.useMdmInitialConnection = exports.useMdmInitialConnectionTempEntity = exports.useMdmModifiedEntity = exports.useMdmModifiedEntityDefaultProfilePic = exports.useMdmProfileErrors = void 0;
|
|
4
|
+
exports.useMdmListener = exports.useMdmAction = exports.useMdmGlobalSearchRequestOptions = exports.useMdmDependentLookupEditorContext = exports.useMdmRelationsDrafts = exports.useMdmAllRelationsToAddAndEdit = exports.useMdmDependentLookupsStructureNode = exports.useMdmActiveErrorsForAttributesPager = exports.useMdmDependentLookupEditorState = exports.useMdmInitialConnection = exports.useMdmInitialConnectionTempEntity = exports.useMdmModifiedEntity = exports.useMdmModifiedEntityDefaultProfilePic = exports.useMdmProfileErrors = void 0;
|
|
5
5
|
var react_context_selector_1 = require("@fluentui/react-context-selector");
|
|
6
6
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
7
7
|
var context_1 = require("./context");
|
|
@@ -170,6 +170,10 @@ var useMdmAllRelationsToAddAndEdit = function (viewIds) {
|
|
|
170
170
|
return useMdmModuleValuesContext(function (context) { return (0, mdm_sdk_1.getAllRelationsToAddAndEdit)(context.relations, viewIds); });
|
|
171
171
|
};
|
|
172
172
|
exports.useMdmAllRelationsToAddAndEdit = useMdmAllRelationsToAddAndEdit;
|
|
173
|
+
var useMdmRelationsDrafts = function (viewId) {
|
|
174
|
+
return useMdmModuleValuesContext(function (context) { return (0, mdm_sdk_1.getDraftsByViewId)(context.relations, viewId); });
|
|
175
|
+
};
|
|
176
|
+
exports.useMdmRelationsDrafts = useMdmRelationsDrafts;
|
|
173
177
|
var useMdmDependentLookupEditorContext = function (attributeValue, attributeType) {
|
|
174
178
|
var value = useMdmModuleValuesContext(function (context) {
|
|
175
179
|
var _a;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { MdmModuleProvider } from './provider';
|
|
2
|
-
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributePresentations, useMdmDefaultMaxValues, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAction, useMdmListener } from './hooks';
|
|
2
|
+
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributePresentations, useMdmDefaultMaxValues, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAction, useMdmListener } from './hooks';
|
|
3
3
|
export type { MdmModuleActionsContextProps, MdmModuleValuesContextProps, MdmModuleListenersContextProps } from './context';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMdmIsCollaborationEnabled = exports.useMdmSearchProviderData = exports.useMdmSearchNavigationData = exports.useMdmDataTenants = exports.useMdmEnvironment = exports.useMdmTenantName = exports.useMdmTenant = exports.useMdmTenantObject = exports.useMdmUserRoles = exports.useMdmUsername = exports.useMdmUser = exports.useMdmMetadata = exports.useMdmDependentLookups = exports.useMdmLookups = exports.useMdmProfileLastLoadedTime = exports.useMdmHistoryEvent = exports.useMdmHistorySlice = exports.useMdmHistoryMode = exports.useMdmHistoryDiff = exports.useMdmIsEditableMode = exports.useMdmIsViewMode = exports.useMdmMode = exports.useMdmEntityUriWithDataTenant = exports.useMdmEntityWithDiff = exports.useMdmEntityUri = exports.useMdmEntity = exports.useMdmModifiedEntities = exports.useMdmLookupAutocomplete = exports.useMdmAttributesSortingStrategy = exports.useMdmDefaultMaxValues = exports.useMdmAttributePresentations = exports.useMdmDateTimeMask = exports.useMdmDateMask = exports.useMdmPivotingAttributes = exports.useMdmShowEntityId = exports.useMdmImageAttributesFieldsOrder = exports.useMdmCollaborationPath = exports.useMdmApiPath = exports.useMdmReltioPath = exports.useMdmImageServicePath = exports.useMdmWorkflowPath = exports.useMdmServicesPath = exports.useMdmDtssPath = exports.useMdmUiPath = exports.useMdmAbsoluteImagePath = exports.useMdmExportPath = exports.useMdmWorkflowEnvironmentUrl = exports.useMdmUiError = exports.useMdmAutoCloseInterval = exports.MdmModuleProvider = void 0;
|
|
4
|
-
exports.useMdmListener = exports.useMdmAction = exports.useMdmGlobalSearchRequestOptions = exports.useMdmDependentLookupEditorContext = exports.useMdmAllRelationsToAddAndEdit = exports.useMdmDependentLookupsStructureNode = exports.useMdmActiveErrorsForAttributesPager = exports.useMdmDependentLookupEditorState = exports.useMdmInitialConnection = exports.useMdmInitialConnectionTempEntity = exports.useMdmModifiedEntity = exports.useMdmModifiedEntityDefaultProfilePic = exports.useMdmProfileErrors = exports.useMdmIsWorkflowEnabled = void 0;
|
|
4
|
+
exports.useMdmListener = exports.useMdmAction = exports.useMdmGlobalSearchRequestOptions = exports.useMdmDependentLookupEditorContext = exports.useMdmAllRelationsToAddAndEdit = exports.useMdmDependentLookupsStructureNode = exports.useMdmActiveErrorsForAttributesPager = exports.useMdmDependentLookupEditorState = exports.useMdmInitialConnection = exports.useMdmInitialConnectionTempEntity = exports.useMdmModifiedEntity = exports.useMdmModifiedEntityDefaultProfilePic = exports.useMdmRelationsDrafts = exports.useMdmProfileErrors = exports.useMdmIsWorkflowEnabled = void 0;
|
|
5
5
|
var provider_1 = require("./provider");
|
|
6
6
|
Object.defineProperty(exports, "MdmModuleProvider", { enumerable: true, get: function () { return provider_1.MdmModuleProvider; } });
|
|
7
7
|
var hooks_1 = require("./hooks");
|
|
@@ -56,6 +56,7 @@ Object.defineProperty(exports, "useMdmSearchProviderData", { enumerable: true, g
|
|
|
56
56
|
Object.defineProperty(exports, "useMdmIsCollaborationEnabled", { enumerable: true, get: function () { return hooks_1.useMdmIsCollaborationEnabled; } });
|
|
57
57
|
Object.defineProperty(exports, "useMdmIsWorkflowEnabled", { enumerable: true, get: function () { return hooks_1.useMdmIsWorkflowEnabled; } });
|
|
58
58
|
Object.defineProperty(exports, "useMdmProfileErrors", { enumerable: true, get: function () { return hooks_1.useMdmProfileErrors; } });
|
|
59
|
+
Object.defineProperty(exports, "useMdmRelationsDrafts", { enumerable: true, get: function () { return hooks_1.useMdmRelationsDrafts; } });
|
|
59
60
|
Object.defineProperty(exports, "useMdmModifiedEntityDefaultProfilePic", { enumerable: true, get: function () { return hooks_1.useMdmModifiedEntityDefaultProfilePic; } });
|
|
60
61
|
Object.defineProperty(exports, "useMdmModifiedEntity", { enumerable: true, get: function () { return hooks_1.useMdmModifiedEntity; } });
|
|
61
62
|
Object.defineProperty(exports, "useMdmInitialConnectionTempEntity", { enumerable: true, get: function () { return hooks_1.useMdmInitialConnectionTempEntity; } });
|
package/cjs/hooks/index.d.ts
CHANGED
|
@@ -25,4 +25,5 @@ export { useSavedStateForEntityType } from './useSavedStateForEntityType';
|
|
|
25
25
|
export { useSnackbar } from './useSnackbar';
|
|
26
26
|
export { useIsMountedRef } from './useIsMountedRef';
|
|
27
27
|
export { useLayoutResetter } from './useLayoutResetter';
|
|
28
|
+
export { useExpandInvalidRelations } from './useExpandInvalidRelations';
|
|
28
29
|
export { useAutoFocus } from './useAutoFocus';
|
package/cjs/hooks/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useAutoFocus = exports.useLayoutResetter = exports.useIsMountedRef = exports.useSnackbar = exports.useSavedStateForEntityType = exports.useReadableSearchState = exports.useEditableConnection = exports.useCustomScripts = exports.useMarkAsNotMatchRequest = exports.useMergeAllRequest = exports.usePagingSimulator = exports.useMatchesLoader = exports.useConfigPermissions = exports.useWhyDidYouUpdate = exports.useUsers = exports.useSavedState = exports.useSafePromise = exports.useRunOnceAfterValueInitialization = exports.useRelationsLoader = exports.useRelationTypeSelector = exports.usePrevious = exports.useDidUpdateEffect = exports.useCommentsEntitiesMap = exports.useCollaboration = exports.useAsyncMount = exports.useAPI = exports.useActions = exports.useScrollToAttributeError = void 0;
|
|
3
|
+
exports.useAutoFocus = exports.useExpandInvalidRelations = exports.useLayoutResetter = exports.useIsMountedRef = exports.useSnackbar = exports.useSavedStateForEntityType = exports.useReadableSearchState = exports.useEditableConnection = exports.useCustomScripts = exports.useMarkAsNotMatchRequest = exports.useMergeAllRequest = exports.usePagingSimulator = exports.useMatchesLoader = exports.useConfigPermissions = exports.useWhyDidYouUpdate = exports.useUsers = exports.useSavedState = exports.useSafePromise = exports.useRunOnceAfterValueInitialization = exports.useRelationsLoader = exports.useRelationTypeSelector = exports.usePrevious = exports.useDidUpdateEffect = exports.useCommentsEntitiesMap = exports.useCollaboration = exports.useAsyncMount = exports.useAPI = exports.useActions = exports.useScrollToAttributeError = void 0;
|
|
4
4
|
var useScrollToAttributeError_1 = require("./useScrollToAttributeError/useScrollToAttributeError");
|
|
5
5
|
Object.defineProperty(exports, "useScrollToAttributeError", { enumerable: true, get: function () { return useScrollToAttributeError_1.useScrollToAttributeError; } });
|
|
6
6
|
var useActions_1 = require("./useActions");
|
|
@@ -55,5 +55,7 @@ var useIsMountedRef_1 = require("./useIsMountedRef");
|
|
|
55
55
|
Object.defineProperty(exports, "useIsMountedRef", { enumerable: true, get: function () { return useIsMountedRef_1.useIsMountedRef; } });
|
|
56
56
|
var useLayoutResetter_1 = require("./useLayoutResetter");
|
|
57
57
|
Object.defineProperty(exports, "useLayoutResetter", { enumerable: true, get: function () { return useLayoutResetter_1.useLayoutResetter; } });
|
|
58
|
+
var useExpandInvalidRelations_1 = require("./useExpandInvalidRelations");
|
|
59
|
+
Object.defineProperty(exports, "useExpandInvalidRelations", { enumerable: true, get: function () { return useExpandInvalidRelations_1.useExpandInvalidRelations; } });
|
|
58
60
|
var useAutoFocus_1 = require("./useAutoFocus");
|
|
59
61
|
Object.defineProperty(exports, "useAutoFocus", { enumerable: true, get: function () { return useAutoFocus_1.useAutoFocus; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useExpandInvalidRelations: (configId: string) => void;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.useExpandInvalidRelations = void 0;
|
|
13
|
+
var ramda_1 = require("ramda");
|
|
14
|
+
var react_1 = require("react");
|
|
15
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
16
|
+
var contexts_1 = require("../contexts");
|
|
17
|
+
var isConnectionHasError = (0, ramda_1.curry)(function (errors, connection) {
|
|
18
|
+
var relationUri = (0, ramda_1.path)(['relation', 'relationUri'], connection);
|
|
19
|
+
return errors.some(function (error) {
|
|
20
|
+
return (0, mdm_sdk_1.areOneHierarchyUris)((0, ramda_1.prop)('uri', error), relationUri) ||
|
|
21
|
+
(0, mdm_sdk_1.areOneHierarchyUris)((0, ramda_1.prop)('parentUri', error), relationUri) ||
|
|
22
|
+
(error.path || []).some(function (errorPath) { return (0, ramda_1.path)(['value', 'relation', 'relationUri'], errorPath) === relationUri; });
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
var getInvalidConnections = function (errors, connections) {
|
|
26
|
+
if (errors === void 0) { errors = []; }
|
|
27
|
+
if (connections === void 0) { connections = []; }
|
|
28
|
+
return (0, ramda_1.filter)(isConnectionHasError(errors), connections);
|
|
29
|
+
};
|
|
30
|
+
var useExpandInvalidRelations = function (configId) {
|
|
31
|
+
var openRelationEditor = (0, contexts_1.useMdmAction)('openRelationEditor');
|
|
32
|
+
var mode = (0, contexts_1.useMdmMode)();
|
|
33
|
+
var profileErrors = (0, contexts_1.useMdmProfileErrors)();
|
|
34
|
+
var shouldOpenInvalidEditors = (0, react_1.useRef)(true);
|
|
35
|
+
var listenToActions = (0, contexts_1.useActionsHook)();
|
|
36
|
+
var _a = (0, contexts_1.useMdmRelationsDrafts)(configId) || {}, _b = _a.addedConnections, addedConnections = _b === void 0 ? [] : _b, _c = _a.editedConnections, editedConnections = _c === void 0 ? [] : _c;
|
|
37
|
+
var relationsToAddAndEdit = (0, contexts_1.useMdmAllRelationsToAddAndEdit)([configId]) || [];
|
|
38
|
+
var preparedConnectionsList = (0, ramda_1.reject)(function (draftConnection) {
|
|
39
|
+
return relationsToAddAndEdit.some((0, ramda_1.eqBy)((0, ramda_1.path)(['relation', 'relationUri']), draftConnection));
|
|
40
|
+
}, __spreadArray(__spreadArray([], addedConnections, true), editedConnections, true));
|
|
41
|
+
var invalidConnections = (0, react_1.useMemo)(function () { return getInvalidConnections(profileErrors, preparedConnectionsList); }, [profileErrors, preparedConnectionsList]);
|
|
42
|
+
var expandInvalidRelatonsListener = (0, contexts_1.useMdmListener)('expandInvalidRelatonsListener');
|
|
43
|
+
var setShouldOpenInvalidEditors = function (shouldOpen) { return (shouldOpenInvalidEditors.current = shouldOpen); };
|
|
44
|
+
var listenerCallback = expandInvalidRelatonsListener(function () { return setShouldOpenInvalidEditors(true); });
|
|
45
|
+
(0, react_1.useEffect)(function () {
|
|
46
|
+
if ((0, mdm_sdk_1.isEditableMode)(mode) && invalidConnections.length && shouldOpenInvalidEditors.current) {
|
|
47
|
+
invalidConnections.forEach(function (connection) { return openRelationEditor(configId, connection); });
|
|
48
|
+
setShouldOpenInvalidEditors(false);
|
|
49
|
+
}
|
|
50
|
+
}, [mode, invalidConnections]);
|
|
51
|
+
(0, react_1.useEffect)(function () {
|
|
52
|
+
var stopListeningActions = listenToActions(listenerCallback);
|
|
53
|
+
return function () { return stopListeningActions(); };
|
|
54
|
+
}, [listenToActions]);
|
|
55
|
+
};
|
|
56
|
+
exports.useExpandInvalidRelations = useExpandInvalidRelations;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const SvgNegativeRuleIcon: React.FC<React.SVGProps<SVGSVGElement>>;
|
|
3
|
+
export default SvgNegativeRuleIcon;
|