@reltio/components 1.4.1643 → 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.
Files changed (59) hide show
  1. package/cjs/components/workflow/components/AssigneeSelector/AssigneeSelector.d.ts +4 -1
  2. package/cjs/components/workflow/components/AssigneeSelector/AssigneeSelector.js +7 -5
  3. package/cjs/components/workflow/components/ReassignButton/ReassignButton.d.ts +7 -0
  4. package/cjs/components/workflow/components/ReassignButton/ReassignButton.js +47 -0
  5. package/cjs/components/workflow/components/ReassignButton/ReassignDialog.d.ts +8 -0
  6. package/cjs/components/workflow/components/ReassignButton/ReassignDialog.js +129 -0
  7. package/cjs/components/workflow/components/ReassignButton/styles.d.ts +1 -0
  8. package/cjs/components/workflow/components/ReassignButton/styles.js +27 -0
  9. package/cjs/components/workflow/hooks/useWorkflowAssignee.d.ts +5 -1
  10. package/cjs/components/workflow/hooks/useWorkflowAssignee.js +27 -12
  11. package/cjs/components/workflow/index.d.ts +1 -0
  12. package/cjs/components/workflow/index.js +3 -1
  13. package/cjs/contexts/MdmModuleContext/context.d.ts +4 -0
  14. package/cjs/contexts/MdmModuleContext/hooks.d.ts +5 -2
  15. package/cjs/contexts/MdmModuleContext/hooks.js +5 -1
  16. package/cjs/contexts/MdmModuleContext/index.d.ts +1 -1
  17. package/cjs/contexts/MdmModuleContext/index.js +2 -1
  18. package/cjs/hooks/index.d.ts +1 -0
  19. package/cjs/hooks/index.js +3 -1
  20. package/cjs/hooks/useExpandInvalidRelations.d.ts +1 -0
  21. package/cjs/hooks/useExpandInvalidRelations.js +56 -0
  22. package/cjs/icons/NegativeRuleIcon.d.ts +2 -2
  23. package/cjs/icons/NegativeRuleIcon.js +4 -4
  24. package/cjs/icons/NegativeRuleTooltipIcon.d.ts +2 -2
  25. package/cjs/icons/NegativeRuleTooltipIcon.js +4 -4
  26. package/cjs/icons/Reassign.d.ts +3 -0
  27. package/cjs/icons/Reassign.js +22 -0
  28. package/cjs/icons/index.d.ts +1 -0
  29. package/cjs/icons/index.js +4 -2
  30. package/esm/components/workflow/components/AssigneeSelector/AssigneeSelector.d.ts +4 -1
  31. package/esm/components/workflow/components/AssigneeSelector/AssigneeSelector.js +7 -5
  32. package/esm/components/workflow/components/ReassignButton/ReassignButton.d.ts +7 -0
  33. package/esm/components/workflow/components/ReassignButton/ReassignButton.js +19 -0
  34. package/esm/components/workflow/components/ReassignButton/ReassignDialog.d.ts +8 -0
  35. package/esm/components/workflow/components/ReassignButton/ReassignDialog.js +101 -0
  36. package/esm/components/workflow/components/ReassignButton/styles.d.ts +1 -0
  37. package/esm/components/workflow/components/ReassignButton/styles.js +24 -0
  38. package/esm/components/workflow/hooks/useWorkflowAssignee.d.ts +5 -1
  39. package/esm/components/workflow/hooks/useWorkflowAssignee.js +27 -12
  40. package/esm/components/workflow/index.d.ts +1 -0
  41. package/esm/components/workflow/index.js +1 -0
  42. package/esm/contexts/MdmModuleContext/context.d.ts +4 -0
  43. package/esm/contexts/MdmModuleContext/hooks.d.ts +5 -2
  44. package/esm/contexts/MdmModuleContext/hooks.js +4 -1
  45. package/esm/contexts/MdmModuleContext/index.d.ts +1 -1
  46. package/esm/contexts/MdmModuleContext/index.js +1 -1
  47. package/esm/hooks/index.d.ts +1 -0
  48. package/esm/hooks/index.js +1 -0
  49. package/esm/hooks/useExpandInvalidRelations.d.ts +1 -0
  50. package/esm/hooks/useExpandInvalidRelations.js +52 -0
  51. package/esm/icons/NegativeRuleIcon.d.ts +2 -2
  52. package/esm/icons/NegativeRuleIcon.js +4 -4
  53. package/esm/icons/NegativeRuleTooltipIcon.d.ts +2 -2
  54. package/esm/icons/NegativeRuleTooltipIcon.js +4 -4
  55. package/esm/icons/Reassign.d.ts +3 -0
  56. package/esm/icons/Reassign.js +17 -0
  57. package/esm/icons/index.d.ts +1 -0
  58. package/esm/icons/index.js +1 -0
  59. package/package.json +2 -2
@@ -15,8 +15,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  var react_1 = __importDefault(require("react"));
18
- var NegativeRuleIcon = function (props) {
19
- return (react_1.default.createElement("svg", __assign({ width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
20
- react_1.default.createElement("path", { d: "M5 0C2.24 0 0 2.24 0 5C0 7.76 2.24 10 5 10C7.76 10 10 7.76 10 5C10 2.24 7.76 0 5 0ZM7.5 5.5H2.5V4.5H7.5V5.5Z", fill: "black", fillOpacity: "0.54" })));
18
+ var SvgNegativeRuleIcon = function (props) {
19
+ return (react_1.default.createElement("svg", __assign({ width: 10, height: 10, viewBox: "0 0 10 10", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
20
+ react_1.default.createElement("path", { d: "M5 0C2.24 0 0 2.24 0 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm2.5 5.5h-5v-1h5v1z", fill: "#000", fillOpacity: 0.54 })));
21
21
  };
22
- exports.default = NegativeRuleIcon;
22
+ exports.default = SvgNegativeRuleIcon;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- declare const NegativeRuleTooltipIcon: React.FC<React.SVGProps<SVGSVGElement>>;
3
- export default NegativeRuleTooltipIcon;
2
+ declare const SvgNegativeRuleTooltipIcon: React.FC<React.SVGProps<SVGSVGElement>>;
3
+ export default SvgNegativeRuleTooltipIcon;
@@ -15,8 +15,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  var react_1 = __importDefault(require("react"));
18
- var NegativeRuleTooltipIcon = function (props) {
19
- return (react_1.default.createElement("svg", __assign({ width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
20
- react_1.default.createElement("path", { d: "M5 0C2.24 0 0 2.24 0 5C0 7.76 2.24 10 5 10C7.76 10 10 7.76 10 5C10 2.24 7.76 0 5 0ZM7.5 5.5H2.5V4.5H7.5V5.5Z", fill: "white", fillOpacity: "0.54" })));
18
+ var SvgNegativeRuleTooltipIcon = function (props) {
19
+ return (react_1.default.createElement("svg", __assign({ width: 10, height: 10, viewBox: "0 0 10 10", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
20
+ react_1.default.createElement("path", { d: "M5 0C2.24 0 0 2.24 0 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm2.5 5.5h-5v-1h5v1z", fill: "#fff", fillOpacity: 0.54 })));
21
21
  };
22
- exports.default = NegativeRuleTooltipIcon;
22
+ exports.default = SvgNegativeRuleTooltipIcon;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const SvgReassign: React.FC<React.SVGProps<SVGSVGElement>>;
3
+ export default SvgReassign;
@@ -0,0 +1,22 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ var react_1 = __importDefault(require("react"));
18
+ var SvgReassign = function (props) {
19
+ return (react_1.default.createElement("svg", __assign({ width: 24, height: 18, viewBox: "0 0 24 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
20
+ react_1.default.createElement("path", { d: "M24 17.454v-2.181c0-2.411-3.905-4.364-8.727-4.364-4.822 0-8.728 1.953-8.728 4.364v2.181H24zM10.91 4.364a4.362 4.362 0 004.363 4.363 4.362 4.362 0 004.363-4.363A4.362 4.362 0 0015.273 0a4.362 4.362 0 00-4.364 4.364zM3.272 1.636V4.91H0v4.364h3.273v3.273L8.727 7.09 3.273 1.636z", fill: "#757575" })));
21
+ };
22
+ exports.default = SvgReassign;
@@ -43,6 +43,7 @@ export { default as Polygon } from './Polygon';
43
43
  export { default as PotentialMatch } from './PotentialMatch';
44
44
  export { default as Profile } from './Profile';
45
45
  export { default as Radius } from './Radius';
46
+ export { default as Reassign } from './Reassign';
46
47
  export { default as Recommended } from './Recommended';
47
48
  export { default as ReferenceAttribute } from './ReferenceAttribute';
48
49
  export { default as Remove } from './Remove';
@@ -3,8 +3,8 @@ 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.Search = exports.ResizeIconInline = exports.Remove = exports.ReferenceAttribute = exports.Recommended = exports.Radius = exports.Profile = exports.PotentialMatch = exports.Polygon = exports.PmTaskIcon = exports.PmIcon = exports.PivotingIcon = exports.PinOutlined = exports.Pin = exports.NotMatchRule = exports.NotMatchDark = exports.NoMatches = exports.NoDataSearch = exports.NoData = exports.NestedAttribute = exports.NegativeRuleTooltipIcon = exports.NegativeRuleIcon = exports.MlMatch = exports.MergeDark = exports.Merge = exports.LogOut = exports.LogIn = exports.IgnoredOutlined = exports.Ignored = exports.Filter = exports.Error = exports.EmptySearchResults = exports.Duplicate = exports.Draw = exports.Download = exports.Details = exports.Description = exports.DeleteRequestTaskIcon = exports.DefaultTaskIcon = exports.DefaultImage = exports.DcrTaskIcon = exports.Create = exports.Copy = exports.CommentBubble = exports.Comment = exports.CollaborationIcon = exports.Calendar = exports.AttributesList = exports.AddComment = exports.Add = void 0;
7
- exports.UploadIcon = exports.UnMerge = exports.Table = exports.SimpleAttribute = exports.SelectAttributes = void 0;
6
+ exports.ResizeIconInline = exports.Remove = exports.ReferenceAttribute = exports.Recommended = exports.Reassign = exports.Radius = exports.Profile = exports.PotentialMatch = exports.Polygon = exports.PmTaskIcon = exports.PmIcon = exports.PivotingIcon = exports.PinOutlined = exports.Pin = exports.NotMatchRule = exports.NotMatchDark = exports.NoMatches = exports.NoDataSearch = exports.NoData = exports.NestedAttribute = exports.NegativeRuleTooltipIcon = exports.NegativeRuleIcon = exports.MlMatch = exports.MergeDark = exports.Merge = exports.LogOut = exports.LogIn = exports.IgnoredOutlined = exports.Ignored = exports.Filter = exports.Error = exports.EmptySearchResults = exports.Duplicate = exports.Draw = exports.Download = exports.Details = exports.Description = exports.DeleteRequestTaskIcon = exports.DefaultTaskIcon = exports.DefaultImage = exports.DcrTaskIcon = exports.Create = exports.Copy = exports.CommentBubble = exports.Comment = exports.CollaborationIcon = exports.Calendar = exports.AttributesList = exports.AddComment = exports.Add = void 0;
7
+ exports.UploadIcon = exports.UnMerge = exports.Table = exports.SimpleAttribute = exports.SelectAttributes = exports.Search = void 0;
8
8
  var Add_1 = require("./Add");
9
9
  Object.defineProperty(exports, "Add", { enumerable: true, get: function () { return __importDefault(Add_1).default; } });
10
10
  var AddComment_1 = require("./AddComment");
@@ -95,6 +95,8 @@ var Profile_1 = require("./Profile");
95
95
  Object.defineProperty(exports, "Profile", { enumerable: true, get: function () { return __importDefault(Profile_1).default; } });
96
96
  var Radius_1 = require("./Radius");
97
97
  Object.defineProperty(exports, "Radius", { enumerable: true, get: function () { return __importDefault(Radius_1).default; } });
98
+ var Reassign_1 = require("./Reassign");
99
+ Object.defineProperty(exports, "Reassign", { enumerable: true, get: function () { return __importDefault(Reassign_1).default; } });
98
100
  var Recommended_1 = require("./Recommended");
99
101
  Object.defineProperty(exports, "Recommended", { enumerable: true, get: function () { return __importDefault(Recommended_1).default; } });
100
102
  var ReferenceAttribute_1 = require("./ReferenceAttribute");
@@ -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;
@@ -3,13 +3,15 @@ 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, isTaskOpen = _a.isTaskOpen;
7
- var _b = useWorkflowAssignee({
6
+ 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;
7
+ var _c = useWorkflowAssignee({
8
8
  taskId: taskId,
9
9
  assignee: assignee,
10
- isOpen: isTaskOpen
11
- }), currentAssignee = _b.assignee, getAssignees = _b.getAssignees, updateAssignee = _b.updateAssignee, updateRequestIsInProgress = _b.updateRequestIsInProgress, readOnly = _b.readOnly;
10
+ showCurrentAssignee: showCurrentAssignee,
11
+ isOpen: isTaskOpen,
12
+ onChange: onChange
13
+ }), currentAssignee = _c.assignee, getAssignees = _c.getAssignees, updateAssignee = _c.updateAssignee, updateRequestIsInProgress = _c.updateRequestIsInProgress, readOnly = _c.readOnly;
12
14
  var disabled = updateRequestIsInProgress || readOnly;
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 }));
15
+ return (React.createElement(DropDownSelector, { isDisabled: disabled, getOptions: getAssignees, onChange: updateAssignee, hideSelectedOptions: false, label: label || i18n.text('Assigned to'), value: currentAssignee, defaultOptions: true, TextFieldProps: { disabled: disabled }, height: 40 }));
14
16
  };
15
17
  export default AssigneeSelector;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ type Props = {
3
+ changeRequestURI: string;
4
+ disabled?: boolean;
5
+ };
6
+ declare const ReassignButton: ({ disabled, changeRequestURI }: Props) => JSX.Element;
7
+ export default ReassignButton;
@@ -0,0 +1,19 @@
1
+ import React, { useState } from 'react';
2
+ import i18n from 'ui-i18n';
3
+ import { SmallIconButtonWithTooltip } from '../../../SmallIconButton';
4
+ import ReassignIcon from '../../../../icons/Reassign';
5
+ import ReassignDialog from './ReassignDialog';
6
+ var ReassignButton = function (_a) {
7
+ var disabled = _a.disabled, changeRequestURI = _a.changeRequestURI;
8
+ var _b = useState(false), isDialogOpen = _b[0], setIsDialogOpen = _b[1];
9
+ var handleOpenDialog = function () {
10
+ setIsDialogOpen(true);
11
+ };
12
+ var handleCloseDialog = function () {
13
+ setIsDialogOpen(false);
14
+ };
15
+ return (React.createElement(React.Fragment, null,
16
+ React.createElement(SmallIconButtonWithTooltip, { "data-reltio-id": "reltio-reassign-button", showForDisabled: true, tooltipTitle: i18n.text('Reassign task'), "aria-label": i18n.text('Reassign task'), icon: ReassignIcon, onClick: handleOpenDialog, size: "L", disabled: disabled || !changeRequestURI }),
17
+ React.createElement(ReassignDialog, { isOpen: isDialogOpen, onClose: handleCloseDialog, changeRequestURI: changeRequestURI })));
18
+ };
19
+ export default ReassignButton;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ type Props = {
3
+ isOpen: boolean;
4
+ onClose: () => void;
5
+ changeRequestURI: string;
6
+ };
7
+ declare const ReassignDialog: ({ isOpen, onClose, changeRequestURI }: Props) => JSX.Element;
8
+ export default ReassignDialog;
@@ -0,0 +1,101 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import React, { useEffect, useState } from 'react';
13
+ import i18n from 'ui-i18n';
14
+ import Button from '@mui/material/Button';
15
+ import Dialog from '@mui/material/Dialog';
16
+ import DialogActions from '@mui/material/DialogActions';
17
+ import DialogContent from '@mui/material/DialogContent';
18
+ import DialogTitle from '@mui/material/DialogTitle';
19
+ import Typography from '@mui/material/Typography';
20
+ import Divider from '@mui/material/Divider';
21
+ import { getTasksForEntity, updateAssigneeForTask } from '@reltio/mdm-sdk';
22
+ import AssigneeSelector from '../../components/AssigneeSelector/AssigneeSelector';
23
+ import { useWorkflowAssignee } from '../../hooks/useWorkflowAssignee';
24
+ import { useSafePromise } from '../../../../hooks';
25
+ import { useMdmTenant, useMdmWorkflowEnvironmentUrl, useMdmWorkflowPath } from '../../../../contexts';
26
+ import LinearLoadIndicator from '../../../../components/LinearLoadIndicator/LinearLoadIndicator';
27
+ import { showWorkflowError } from '../../helpers/errors';
28
+ import { useStyles } from './styles';
29
+ var ReassignDialog = function (_a) {
30
+ var isOpen = _a.isOpen, onClose = _a.onClose, changeRequestURI = _a.changeRequestURI;
31
+ var styles = useStyles();
32
+ var workflowPath = useMdmWorkflowPath();
33
+ var environment = useMdmWorkflowEnvironmentUrl();
34
+ var tenant = useMdmTenant();
35
+ var _b = useState(null), task = _b[0], setTask = _b[1];
36
+ var _c = useState(false), loading = _c[0], setLoading = _c[1];
37
+ var safePromise = useSafePromise();
38
+ var _d = task || {}, currentAssignee = _d.assignee, taskId = _d.taskId;
39
+ var _e = useState(null), assignee = _e[0], setAssignee = _e[1];
40
+ var handleClose = function () {
41
+ setAssignee(null);
42
+ onClose();
43
+ };
44
+ var readOnly = useWorkflowAssignee({
45
+ taskId: taskId,
46
+ assignee: '',
47
+ isOpen: task === null || task === void 0 ? void 0 : task.isOpen
48
+ }).readOnly;
49
+ var handleReassign = function () {
50
+ if (!readOnly) {
51
+ setLoading(true);
52
+ updateAssigneeForTask({
53
+ taskId: taskId,
54
+ workflowPath: workflowPath,
55
+ environment: environment,
56
+ tenant: tenant,
57
+ assignee: assignee
58
+ })
59
+ .then(function () {
60
+ setTask(__assign(__assign({}, task), { assignee: assignee }));
61
+ handleClose();
62
+ })
63
+ .catch(showWorkflowError)
64
+ .finally(function () {
65
+ setLoading(false);
66
+ });
67
+ }
68
+ };
69
+ useEffect(function () {
70
+ if (changeRequestURI) {
71
+ setLoading(true);
72
+ safePromise(getTasksForEntity({
73
+ entityUri: changeRequestURI,
74
+ workflowPath: workflowPath,
75
+ environment: environment,
76
+ tenant: tenant,
77
+ includeClosed: false
78
+ }))
79
+ .then(function (response) {
80
+ var tasks = response.data;
81
+ setTask(tasks ? tasks[0] : null);
82
+ })
83
+ .finally(function () {
84
+ setLoading(false);
85
+ });
86
+ }
87
+ }, [changeRequestURI, environment, safePromise, tenant, workflowPath]);
88
+ return (React.createElement(Dialog, { open: isOpen, onClose: handleClose },
89
+ React.createElement(DialogTitle, null, i18n.text('Reassign task')),
90
+ React.createElement(DialogContent, { className: styles.dialogContent },
91
+ loading && React.createElement(LinearLoadIndicator, null),
92
+ React.createElement("div", { className: styles.dialogText },
93
+ React.createElement(Typography, { className: styles.caption }, i18n.text('Assigned to')),
94
+ React.createElement(Typography, { className: styles.currentAssignee }, currentAssignee)),
95
+ !readOnly && (React.createElement(AssigneeSelector, { taskId: taskId, isTaskOpen: isOpen, label: i18n.text('Reassign to'), assignee: currentAssignee, showCurrentAssignee: false, onChange: setAssignee }))),
96
+ React.createElement(Divider, null),
97
+ React.createElement(DialogActions, null,
98
+ React.createElement(Button, { onClick: handleClose }, i18n.text('Cancel')),
99
+ React.createElement(Button, { color: "primary", onClick: handleReassign, disabled: readOnly || !assignee || loading }, i18n.text('Reassign')))));
100
+ };
101
+ export 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,24 @@
1
+ import { makeStyles } from '@mui/styles';
2
+ export var useStyles = makeStyles(function (theme) { return ({
3
+ caption: {
4
+ fontSize: '12px',
5
+ color: theme.palette.text.secondary
6
+ },
7
+ currentAssignee: {
8
+ fontSize: '14px',
9
+ color: theme.palette.text.primary
10
+ },
11
+ dialogText: {
12
+ marginBottom: '16px'
13
+ },
14
+ title: {
15
+ padding: '12px 24px'
16
+ },
17
+ dialogContent: {
18
+ paddingTop: '0px',
19
+ minWidth: '500px'
20
+ },
21
+ disabled: {
22
+ fill: theme.palette.text.disabled
23
+ }
24
+ }); });
@@ -3,7 +3,11 @@ type AssigneeOption = {
3
3
  label: string;
4
4
  value: string;
5
5
  };
6
- export declare const useWorkflowAssignee: ({ assignee, taskId, isOpen }: Partial<Pick<WorkflowTaskData, 'taskId' | 'assignee' | 'isOpen'>>) => {
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;
@@ -11,20 +11,20 @@ var assigneeToValue = function (assignee) { return ({
11
11
  value: assignee
12
12
  }); };
13
13
  export var useWorkflowAssignee = function (_a) {
14
- var assignee = _a.assignee, taskId = _a.taskId, isOpen = _a.isOpen;
14
+ var assignee = _a.assignee, _b = _a.showCurrentAssignee, showCurrentAssignee = _b === void 0 ? true : _b, taskId = _a.taskId, isOpen = _a.isOpen, onChange = _a.onChange;
15
15
  var updateTaskState = (useContext(WorkflowTasksContext) || {}).updateTaskState;
16
16
  var workflowPath = useMdmWorkflowPath();
17
17
  var environment = useMdmWorkflowEnvironmentUrl();
18
18
  var tenant = useMdmTenant();
19
19
  var updateSafePromise = useSafePromise();
20
20
  var getSafePromise = useSafePromise();
21
- var _b = useState(null), currentAssignee = _b[0], setCurrentAssignee = _b[1];
22
- var _c = useState(), assignees = _c[0], setAssignees = _c[1];
23
- var _d = useState(false), updateRequestIsInProgress = _d[0], setUpdateRequestIsInProgress = _d[1];
21
+ var _c = useState(null), currentAssignee = _c[0], setCurrentAssignee = _c[1];
22
+ var _d = useState(), assignees = _d[0], setAssignees = _d[1];
23
+ var _e = useState(false), updateRequestIsInProgress = _e[0], setUpdateRequestIsInProgress = _e[1];
24
24
  var checkWorkflowPermission = useWorkflowCheckPermission();
25
25
  var canUpdateTask = checkWorkflowPermission('UPDATE_TASK') && isOpenTask(isOpen);
26
26
  useEffect(function () {
27
- setCurrentAssignee(assigneeToValue(assignee));
27
+ showCurrentAssignee && setCurrentAssignee(assigneeToValue(assignee));
28
28
  }, [assignee]);
29
29
  var getAssignees = useCallback(function (text) {
30
30
  if (workflowPath && canUpdateTask && taskId) {
@@ -41,6 +41,7 @@ export var useWorkflowAssignee = function (_a) {
41
41
  .then(function (result) {
42
42
  var data = result.data;
43
43
  var assignees = data
44
+ .filter(function (a) { return (showCurrentAssignee ? true : a !== assignee); })
44
45
  .sort(function (a, b) {
45
46
  return utils.strings.sort('asc', a, b);
46
47
  })
@@ -52,21 +53,35 @@ export var useWorkflowAssignee = function (_a) {
52
53
  }
53
54
  },
54
55
  // eslint-disable-next-line react-hooks/exhaustive-deps
55
- [workflowPath, taskId, environment, tenant, assignees, setAssignees, canUpdateTask]);
56
+ [
57
+ workflowPath,
58
+ taskId,
59
+ environment,
60
+ tenant,
61
+ assignees,
62
+ setAssignees,
63
+ canUpdateTask,
64
+ assignee,
65
+ showCurrentAssignee
66
+ ]);
56
67
  var updateAssignee = useCallback(function (newValue) {
57
- if (workflowPath && canUpdateTask && taskId) {
58
- var assignee_1 = newValue.value;
68
+ var assignee = newValue.value;
69
+ if (onChange) {
70
+ setCurrentAssignee(assigneeToValue(assignee));
71
+ onChange(assignee);
72
+ }
73
+ if (!onChange && workflowPath && canUpdateTask && taskId) {
59
74
  setUpdateRequestIsInProgress(true);
60
75
  updateSafePromise(updateAssigneeForTask({
61
76
  taskId: taskId,
62
77
  workflowPath: workflowPath,
63
78
  environment: environment,
64
79
  tenant: tenant,
65
- assignee: assignee_1
80
+ assignee: assignee
66
81
  }))
67
82
  .then(function () {
68
- setCurrentAssignee(assigneeToValue(assignee_1));
69
- updateTaskState === null || updateTaskState === void 0 ? void 0 : updateTaskState(taskId, { assignee: assignee_1 });
83
+ setCurrentAssignee(assigneeToValue(assignee));
84
+ updateTaskState === null || updateTaskState === void 0 ? void 0 : updateTaskState(taskId, { assignee: assignee });
70
85
  })
71
86
  .catch(showWorkflowError)
72
87
  .finally(function () {
@@ -75,7 +90,7 @@ export var useWorkflowAssignee = function (_a) {
75
90
  }
76
91
  },
77
92
  // eslint-disable-next-line react-hooks/exhaustive-deps
78
- [workflowPath, taskId, environment, tenant, canUpdateTask]);
93
+ [workflowPath, taskId, environment, tenant, canUpdateTask, onChange]);
79
94
  return {
80
95
  assignee: currentAssignee,
81
96
  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';
@@ -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';
@@ -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,5 +1,5 @@
1
1
  import { useContextSelector } from '@fluentui/react-context-selector';
2
- import { isEditableMode as checkIsEditableMode, isViewMode as checkIsViewMode, getDependentLookupsStructureNode, getDependentLookupEditorState, getAllRelationsToAddAndEdit, getInitialConnection, getInitialConnectionTempEntity, getCachedActiveErrorsForAttributesPager, getGlobalSearchRequestOptions } from '@reltio/mdm-sdk';
2
+ import { isEditableMode as checkIsEditableMode, isViewMode as checkIsViewMode, getDependentLookupsStructureNode, getDependentLookupEditorState, getAllRelationsToAddAndEdit, getInitialConnection, getInitialConnectionTempEntity, getCachedActiveErrorsForAttributesPager, getGlobalSearchRequestOptions, getDraftsByViewId } from '@reltio/mdm-sdk';
3
3
  import { MdmModuleActionsContext, MdmModuleListenersContext, MdmModuleValuesContext } from './context';
4
4
  import { getDependentLookupEditorContext } from './selectors/dependentLookupEditorContext';
5
5
  import { getModifiedEntity, getModifiedEntityDefaultProfilePic } from './selectors/entity';
@@ -107,6 +107,9 @@ export var useMdmDependentLookupsStructureNode = function (attributeTypeUri) {
107
107
  export var useMdmAllRelationsToAddAndEdit = function (viewIds) {
108
108
  return useMdmModuleValuesContext(function (context) { return getAllRelationsToAddAndEdit(context.relations, viewIds); });
109
109
  };
110
+ export var useMdmRelationsDrafts = function (viewId) {
111
+ return useMdmModuleValuesContext(function (context) { return getDraftsByViewId(context.relations, viewId); });
112
+ };
110
113
  export var useMdmDependentLookupEditorContext = function (attributeValue, attributeType) {
111
114
  var value = useMdmModuleValuesContext(function (context) {
112
115
  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,2 +1,2 @@
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';
@@ -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';
@@ -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';
@@ -0,0 +1 @@
1
+ export declare const useExpandInvalidRelations: (configId: string) => void;
@@ -0,0 +1,52 @@
1
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
10
+ import { curry, eqBy, filter, path, prop, reject } from 'ramda';
11
+ import { useEffect, useMemo, useRef } from 'react';
12
+ import { areOneHierarchyUris, isEditableMode } from '@reltio/mdm-sdk';
13
+ import { useActionsHook, useMdmAction, useMdmAllRelationsToAddAndEdit, useMdmMode, useMdmProfileErrors, useMdmRelationsDrafts, useMdmListener } from '../contexts';
14
+ var isConnectionHasError = curry(function (errors, connection) {
15
+ var relationUri = path(['relation', 'relationUri'], connection);
16
+ return errors.some(function (error) {
17
+ return areOneHierarchyUris(prop('uri', error), relationUri) ||
18
+ areOneHierarchyUris(prop('parentUri', error), relationUri) ||
19
+ (error.path || []).some(function (errorPath) { return path(['value', 'relation', 'relationUri'], errorPath) === relationUri; });
20
+ });
21
+ });
22
+ var getInvalidConnections = function (errors, connections) {
23
+ if (errors === void 0) { errors = []; }
24
+ if (connections === void 0) { connections = []; }
25
+ return filter(isConnectionHasError(errors), connections);
26
+ };
27
+ export var useExpandInvalidRelations = function (configId) {
28
+ var openRelationEditor = useMdmAction('openRelationEditor');
29
+ var mode = useMdmMode();
30
+ var profileErrors = useMdmProfileErrors();
31
+ var shouldOpenInvalidEditors = useRef(true);
32
+ var listenToActions = useActionsHook();
33
+ var _a = useMdmRelationsDrafts(configId) || {}, _b = _a.addedConnections, addedConnections = _b === void 0 ? [] : _b, _c = _a.editedConnections, editedConnections = _c === void 0 ? [] : _c;
34
+ var relationsToAddAndEdit = useMdmAllRelationsToAddAndEdit([configId]) || [];
35
+ var preparedConnectionsList = reject(function (draftConnection) {
36
+ return relationsToAddAndEdit.some(eqBy(path(['relation', 'relationUri']), draftConnection));
37
+ }, __spreadArray(__spreadArray([], addedConnections, true), editedConnections, true));
38
+ var invalidConnections = useMemo(function () { return getInvalidConnections(profileErrors, preparedConnectionsList); }, [profileErrors, preparedConnectionsList]);
39
+ var expandInvalidRelatonsListener = useMdmListener('expandInvalidRelatonsListener');
40
+ var setShouldOpenInvalidEditors = function (shouldOpen) { return (shouldOpenInvalidEditors.current = shouldOpen); };
41
+ var listenerCallback = expandInvalidRelatonsListener(function () { return setShouldOpenInvalidEditors(true); });
42
+ useEffect(function () {
43
+ if (isEditableMode(mode) && invalidConnections.length && shouldOpenInvalidEditors.current) {
44
+ invalidConnections.forEach(function (connection) { return openRelationEditor(configId, connection); });
45
+ setShouldOpenInvalidEditors(false);
46
+ }
47
+ }, [mode, invalidConnections]);
48
+ useEffect(function () {
49
+ var stopListeningActions = listenToActions(listenerCallback);
50
+ return function () { return stopListeningActions(); };
51
+ }, [listenToActions]);
52
+ };
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- declare const NegativeRuleIcon: React.FC<React.SVGProps<SVGSVGElement>>;
3
- export default NegativeRuleIcon;
2
+ declare const SvgNegativeRuleIcon: React.FC<React.SVGProps<SVGSVGElement>>;
3
+ export default SvgNegativeRuleIcon;