@reltio/components 1.4.2207 → 1.4.2209

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 (77) hide show
  1. package/AttributesErrorsPanel/components/Error/Error.js +2 -2
  2. package/cjs/AttributesErrorsPanel/components/Error/Error.js +2 -2
  3. package/cjs/contexts/MdmModuleContext/context.d.ts +2 -0
  4. package/cjs/contexts/MdmModuleContext/hooks.d.ts +1 -0
  5. package/cjs/contexts/MdmModuleContext/hooks.js +3 -1
  6. package/cjs/contexts/MdmModuleContext/index.d.ts +1 -1
  7. package/cjs/contexts/MdmModuleContext/index.js +2 -1
  8. package/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +1 -2
  9. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +2 -1
  10. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.js +8 -3
  11. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +49 -8
  12. package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
  13. package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditor/DCRValueEditor.d.ts +1 -1
  14. package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +1 -1
  15. package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +2 -1
  16. package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +14 -8
  17. package/cjs/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.d.ts +2 -0
  18. package/cjs/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.js +44 -0
  19. package/cjs/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.module.css.js +9 -0
  20. package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +12 -7
  21. package/cjs/features/workflow/TaskActionButtons/TaskActionButtons.js +6 -4
  22. package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +10 -3
  23. package/cjs/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.js +6 -4
  24. package/cjs/features/workflow/{ChangeRequestEditor/context → contexts/ChangeRequestEditorContext}/index.d.ts +20 -10
  25. package/cjs/features/workflow/{ChangeRequestEditor/context → contexts/ChangeRequestEditorContext}/index.js +40 -2
  26. package/cjs/features/workflow/helpers/dcr.d.ts +8 -1
  27. package/cjs/features/workflow/helpers/dcr.js +186 -1
  28. package/cjs/features/workflow/helpers/merge.js +3 -3
  29. package/cjs/features/workflow/helpers/validation.d.ts +17 -0
  30. package/cjs/features/workflow/helpers/validation.js +333 -0
  31. package/cjs/features/workflow/hooks/useApplyDcrChanges.d.ts +3 -0
  32. package/cjs/features/workflow/hooks/useApplyDcrChanges.js +155 -0
  33. package/cjs/features/workflow/hooks/useDCRValidation.d.ts +5 -0
  34. package/cjs/features/workflow/hooks/useDCRValidation.js +153 -0
  35. package/cjs/features/workflow/hooks/useWorkflowActions.d.ts +7 -2
  36. package/cjs/features/workflow/hooks/useWorkflowActions.js +31 -8
  37. package/cjs/features/workflow/types.d.ts +12 -1
  38. package/cjs/hooks/useScrollToAttributeError/useScrollToAttributeError.d.ts +2 -1
  39. package/cjs/hooks/useScrollToAttributeError/useScrollToAttributeError.js +2 -2
  40. package/contexts/MdmModuleContext/context.d.ts +2 -0
  41. package/contexts/MdmModuleContext/hooks.d.ts +1 -0
  42. package/contexts/MdmModuleContext/hooks.js +1 -0
  43. package/contexts/MdmModuleContext/index.d.ts +1 -1
  44. package/contexts/MdmModuleContext/index.js +1 -1
  45. package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +1 -2
  46. package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +2 -1
  47. package/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.js +8 -3
  48. package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +23 -5
  49. package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
  50. package/features/workflow/ChangeRequestEditor/components/DCRValueEditor/DCRValueEditor.d.ts +1 -1
  51. package/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +1 -1
  52. package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +2 -1
  53. package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +8 -2
  54. package/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.d.ts +2 -0
  55. package/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.js +14 -0
  56. package/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.module.css.js +9 -0
  57. package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +12 -7
  58. package/features/workflow/TaskActionButtons/TaskActionButtons.js +6 -4
  59. package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +11 -4
  60. package/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.js +6 -4
  61. package/features/workflow/{ChangeRequestEditor/context → contexts/ChangeRequestEditorContext}/index.d.ts +20 -10
  62. package/features/workflow/{ChangeRequestEditor/context → contexts/ChangeRequestEditorContext}/index.js +41 -3
  63. package/features/workflow/helpers/dcr.d.ts +8 -1
  64. package/features/workflow/helpers/dcr.js +186 -2
  65. package/features/workflow/helpers/merge.js +3 -3
  66. package/features/workflow/helpers/validation.d.ts +17 -0
  67. package/features/workflow/helpers/validation.js +326 -0
  68. package/features/workflow/hooks/useApplyDcrChanges.d.ts +3 -0
  69. package/features/workflow/hooks/useApplyDcrChanges.js +151 -0
  70. package/features/workflow/hooks/useDCRValidation.d.ts +5 -0
  71. package/features/workflow/hooks/useDCRValidation.js +149 -0
  72. package/features/workflow/hooks/useWorkflowActions.d.ts +7 -2
  73. package/features/workflow/hooks/useWorkflowActions.js +31 -8
  74. package/features/workflow/types.d.ts +12 -1
  75. package/hooks/useScrollToAttributeError/useScrollToAttributeError.d.ts +2 -1
  76. package/hooks/useScrollToAttributeError/useScrollToAttributeError.js +2 -2
  77. package/package.json +2 -2
@@ -41,23 +41,25 @@ import { isOpenTask } from '../helpers/common';
41
41
  import { WorkflowTasksContext } from '../../../contexts/WorkflowTasksContext';
42
42
  import { useMdmTenant, useMdmUsername, useMdmWorkflowEnvironmentUrl, useMdmWorkflowPath } from '../../../contexts/MdmModuleContext';
43
43
  import { useCommentDialog } from '../../../contexts/CommentDialogContext';
44
- export var useWorkflowActions = function (task, onActionSuccess) {
45
- var _a = task !== null && task !== void 0 ? task : {}, possibleActions = _a.possibleActions, assignee = _a.assignee, taskId = _a.taskId, isOpen = _a.isOpen;
44
+ import { showDefaultErrorMessage } from '../../../helpers/errors';
45
+ export var useWorkflowActions = function (_a) {
46
+ var task = _a.task, onActionSuccess = _a.onActionSuccess, beforeAction = _a.beforeAction;
47
+ var _b = task !== null && task !== void 0 ? task : {}, possibleActions = _b.possibleActions, assignee = _b.assignee, taskId = _b.taskId, isOpen = _b.isOpen;
46
48
  var workflowTasks = useContext(WorkflowTasksContext);
47
49
  var workflowPath = useMdmWorkflowPath();
48
50
  var environment = useMdmWorkflowEnvironmentUrl();
49
51
  var tenant = useMdmTenant();
50
52
  var username = useMdmUsername();
51
53
  var showCommentDialog = useCommentDialog();
52
- var _b = useState(false), actionRequestIsInProgress = _b[0], setActionRequestIsInProgress = _b[1];
54
+ var _c = useState(false), actionRequestIsInProgress = _c[0], setActionRequestIsInProgress = _c[1];
53
55
  var handleActionSuccess = onActionSuccess !== null && onActionSuccess !== void 0 ? onActionSuccess : workflowTasks === null || workflowTasks === void 0 ? void 0 : workflowTasks.onActionSuccess;
54
56
  var performTaskAction = useCallback(function (action, commentRequired) {
55
57
  return function (comment) { return __awaiter(void 0, void 0, void 0, function () {
56
- var processInstanceComment;
58
+ var processInstanceComment, outcome, error_1;
57
59
  return __generator(this, function (_a) {
58
60
  switch (_a.label) {
59
61
  case 0:
60
- if (!(workflowPath && taskId)) return [3 /*break*/, 3];
62
+ if (!(workflowPath && taskId)) return [3 /*break*/, 7];
61
63
  setActionRequestIsInProgress(true);
62
64
  processInstanceComment = typeof comment === 'string' && comment.length ? comment : null;
63
65
  if (!(commentRequired && !processInstanceComment)) return [3 /*break*/, 2];
@@ -70,6 +72,27 @@ export var useWorkflowActions = function (task, onActionSuccess) {
70
72
  }
71
73
  _a.label = 2;
72
74
  case 2:
75
+ if (!beforeAction) return [3 /*break*/, 6];
76
+ _a.label = 3;
77
+ case 3:
78
+ _a.trys.push([3, 5, , 6]);
79
+ return [4 /*yield*/, beforeAction()];
80
+ case 4:
81
+ outcome = _a.sent();
82
+ if (!outcome.proceed) {
83
+ if (outcome.error) {
84
+ showDefaultErrorMessage(outcome.error);
85
+ }
86
+ setActionRequestIsInProgress(false);
87
+ return [2 /*return*/];
88
+ }
89
+ return [3 /*break*/, 6];
90
+ case 5:
91
+ error_1 = _a.sent();
92
+ showDefaultErrorMessage(error_1);
93
+ setActionRequestIsInProgress(false);
94
+ return [2 /*return*/];
95
+ case 6:
73
96
  runTaskAction({
74
97
  taskId: taskId,
75
98
  workflowPath: workflowPath,
@@ -85,12 +108,12 @@ export var useWorkflowActions = function (task, onActionSuccess) {
85
108
  .finally(function () {
86
109
  setActionRequestIsInProgress(false);
87
110
  });
88
- _a.label = 3;
89
- case 3: return [2 /*return*/];
111
+ _a.label = 7;
112
+ case 7: return [2 /*return*/];
90
113
  }
91
114
  });
92
115
  }); };
93
- }, [workflowPath, taskId, environment, tenant, handleActionSuccess, showCommentDialog]);
116
+ }, [workflowPath, taskId, environment, tenant, handleActionSuccess, showCommentDialog, beforeAction]);
94
117
  var actions = useMemo(function () {
95
118
  return username === assignee && isOpenTask(isOpen)
96
119
  ? (possibleActions || []).map(function (_a) {
@@ -1,4 +1,4 @@
1
- import { AttributeType, DCRAttributeValue, DCROperationTypes, DCRRelationInfo, EnrichedChangeValue, TRelationType, ChangeValue } from '@reltio/mdm-sdk';
1
+ import { AttributeType, DCRAttributeValue, DCROperationTypes, DCRRelationInfo, EnrichedChangeValue, TRelationType, ChangeValue, SimpleAttributeValue, PrimitiveValue } from '@reltio/mdm-sdk';
2
2
  export type TaskAction = {
3
3
  text: string;
4
4
  onClick: (comment: string) => void;
@@ -19,3 +19,14 @@ export type Diff = {
19
19
  export type Title = {
20
20
  label: string;
21
21
  };
22
+ export type BeforeActionOutcome = {
23
+ proceed: boolean;
24
+ error?: unknown;
25
+ };
26
+ export type LineDataValue = SimpleAttributeValue | {
27
+ value: string[] | PrimitiveValue;
28
+ };
29
+ export type LineData = {
30
+ value?: LineDataValue;
31
+ isRejected?: boolean;
32
+ };
@@ -3,8 +3,9 @@ import { ScrollToElementContext } from '../../contexts/ScrollToElementContext';
3
3
  type Props = {
4
4
  highlightedError: ContextType<typeof ScrollToElementContext> | null;
5
5
  isSimple?: boolean;
6
+ className?: string;
6
7
  };
7
- export declare const useScrollToAttributeError: ({ highlightedError: context, isSimple }: Props) => {
8
+ export declare const useScrollToAttributeError: ({ highlightedError: context, isSimple, className }: Props) => {
8
9
  ref: import("react").MutableRefObject<HTMLDivElement>;
9
10
  errorClassName: string;
10
11
  } | {
@@ -5,7 +5,7 @@ import { ErrorSeverity } from '@reltio/mdm-sdk';
5
5
  import { useStyles } from './styles';
6
6
  export var useScrollToAttributeError = function (_a) {
7
7
  var _b;
8
- var context = _a.highlightedError, _c = _a.isSimple, isSimple = _c === void 0 ? false : _c;
8
+ var context = _a.highlightedError, _c = _a.isSimple, isSimple = _c === void 0 ? false : _c, className = _a.className;
9
9
  var styles = useStyles();
10
10
  var ref = useRef(null);
11
11
  var severity = pathOr(ErrorSeverity.ERROR, ['element', 'severity'])(context);
@@ -13,7 +13,7 @@ export var useScrollToAttributeError = function (_a) {
13
13
  _b[styles.highlightError] = severity === ErrorSeverity.ERROR,
14
14
  _b[styles.highlightWarning] = severity === ErrorSeverity.WARNING,
15
15
  _b[styles.simpleAttribute] = isSimple,
16
- _b));
16
+ _b), className);
17
17
  useEffect(function () {
18
18
  if (context) {
19
19
  context.scrollIntoRef(ref);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.2207",
3
+ "version": "1.4.2209",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./index.js",
@@ -11,7 +11,7 @@
11
11
  "@fluentui/react-context-selector": "^9.1.26",
12
12
  "@googlemaps/markerclusterer": "^2.5.3",
13
13
  "@react-sigma/core": "3.4.0",
14
- "@reltio/mdm-sdk": "^1.4.2009",
14
+ "@reltio/mdm-sdk": "^1.4.2011",
15
15
  "@vis.gl/react-google-maps": "^1.3.0",
16
16
  "d3-cloud": "^1.2.5",
17
17
  "d3-geo": "^2.0.1",