@reltio/components 1.4.2189 → 1.4.2191

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 (133) hide show
  1. package/ProfileBand/ProfileBand.d.ts +5 -4
  2. package/ProfileBand/ProfileBand.js +4 -5
  3. package/ProfileBand/ProfileBand.module.css.js +9 -0
  4. package/cjs/ProfileBand/ProfileBand.d.ts +5 -4
  5. package/cjs/ProfileBand/ProfileBand.js +14 -15
  6. package/cjs/ProfileBand/ProfileBand.module.css.js +9 -0
  7. package/cjs/contexts/MdmModuleContext/context.d.ts +2 -0
  8. package/cjs/contexts/MdmModuleContext/hooks.d.ts +1 -0
  9. package/cjs/contexts/MdmModuleContext/hooks.js +3 -1
  10. package/cjs/contexts/MdmModuleContext/index.d.ts +1 -1
  11. package/cjs/contexts/MdmModuleContext/index.js +2 -1
  12. package/cjs/features/history/HistoryRow/styles.d.ts +1 -1
  13. package/cjs/features/workflow/AddWorkflowDialog/AddWorkflowDialog.spec.js +67 -0
  14. package/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.d.ts +8 -0
  15. package/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +18 -0
  16. package/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.module.css.js +9 -0
  17. package/cjs/features/workflow/ChangeRequestEditor/index.d.ts +1 -0
  18. package/cjs/features/workflow/ChangeRequestEditor/index.js +5 -0
  19. package/cjs/features/workflow/ReviewDCRButton/ReviewDCRButton.d.ts +6 -0
  20. package/cjs/features/workflow/ReviewDCRButton/ReviewDCRButton.js +19 -0
  21. package/cjs/features/workflow/ReviewDCRButton/ReviewDCRButton.module.css.js +9 -0
  22. package/cjs/features/workflow/ReviewDCRButton/index.d.ts +1 -0
  23. package/cjs/features/workflow/ReviewDCRButton/index.js +5 -0
  24. package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.d.ts +11 -0
  25. package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +63 -0
  26. package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.module.css.js +9 -0
  27. package/cjs/features/workflow/ReviewDCRDialog/components/DCRChangesSummary/DCRChangesSummary.d.ts +8 -0
  28. package/cjs/features/workflow/ReviewDCRDialog/components/DCRChangesSummary/DCRChangesSummary.js +73 -0
  29. package/cjs/features/workflow/ReviewDCRDialog/components/DCRChangesSummary/DCRChangesSummary.module.css.js +9 -0
  30. package/cjs/features/workflow/ReviewDCRDialog/components/DCRChangesSummary/index.d.ts +1 -0
  31. package/cjs/features/workflow/ReviewDCRDialog/components/DCRChangesSummary/index.js +5 -0
  32. package/cjs/features/workflow/ReviewDCRDialog/components/DCRSummaryInfo/DCRSummaryInfo.d.ts +9 -0
  33. package/cjs/features/workflow/ReviewDCRDialog/components/DCRSummaryInfo/DCRSummaryInfo.js +40 -0
  34. package/cjs/features/workflow/ReviewDCRDialog/components/DCRSummaryInfo/DCRSummaryInfo.module.css.js +9 -0
  35. package/cjs/features/workflow/ReviewDCRDialog/helpers/calculateDCRChanges.d.ts +3 -0
  36. package/cjs/features/workflow/ReviewDCRDialog/helpers/calculateDCRChanges.js +19 -0
  37. package/cjs/features/workflow/ReviewDCRDialog/helpers/calculateDCRChanges.test.d.ts +1 -0
  38. package/cjs/features/workflow/ReviewDCRDialog/helpers/calculateDCRChanges.test.js +124 -0
  39. package/cjs/features/workflow/ReviewDCRDialog/helpers/index.d.ts +1 -0
  40. package/cjs/features/workflow/ReviewDCRDialog/helpers/index.js +5 -0
  41. package/cjs/features/workflow/ReviewDCRDialog/index.d.ts +1 -0
  42. package/cjs/features/workflow/ReviewDCRDialog/index.js +5 -0
  43. package/cjs/features/workflow/TaskActionButtons/TaskActionButtons.spec.js +1 -1
  44. package/cjs/features/workflow/WorkflowActionButtons/WorkflowActionButtons.d.ts +12 -0
  45. package/cjs/features/workflow/WorkflowActionButtons/WorkflowActionButtons.js +57 -0
  46. package/cjs/features/workflow/WorkflowActionButtons/index.d.ts +1 -0
  47. package/cjs/features/workflow/WorkflowActionButtons/index.js +5 -0
  48. package/cjs/features/workflow/WorkflowComments/WorkflowComments.d.ts +7 -1
  49. package/cjs/features/workflow/WorkflowComments/WorkflowComments.js +15 -31
  50. package/cjs/features/workflow/WorkflowComments/WorkflowComments.module.css.js +9 -0
  51. package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +46 -6
  52. package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.spec.js +80 -5
  53. package/cjs/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.d.ts +2 -1
  54. package/cjs/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.js +30 -29
  55. package/cjs/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.module.css.js +9 -0
  56. package/cjs/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.spec.js +124 -2
  57. package/cjs/features/workflow/WorkflowTaskCard/components/PotentialMatchTaskCard/PotentialMatchTaskCard.spec.js +69 -3
  58. package/cjs/features/workflow/index.d.ts +2 -0
  59. package/cjs/features/workflow/index.js +5 -1
  60. package/cjs/icons/RequestSummary.d.ts +3 -0
  61. package/cjs/icons/RequestSummary.js +24 -0
  62. package/cjs/icons/ReviewDCR.d.ts +3 -0
  63. package/cjs/icons/ReviewDCR.js +22 -0
  64. package/contexts/MdmModuleContext/context.d.ts +2 -0
  65. package/contexts/MdmModuleContext/hooks.d.ts +1 -0
  66. package/contexts/MdmModuleContext/hooks.js +1 -0
  67. package/contexts/MdmModuleContext/index.d.ts +1 -1
  68. package/contexts/MdmModuleContext/index.js +1 -1
  69. package/features/history/HistoryRow/styles.d.ts +1 -1
  70. package/features/workflow/AddWorkflowDialog/AddWorkflowDialog.spec.js +67 -0
  71. package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.d.ts +8 -0
  72. package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +11 -0
  73. package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.module.css.js +9 -0
  74. package/features/workflow/ChangeRequestEditor/index.d.ts +1 -0
  75. package/features/workflow/ChangeRequestEditor/index.js +1 -0
  76. package/features/workflow/ReviewDCRButton/ReviewDCRButton.d.ts +6 -0
  77. package/features/workflow/ReviewDCRButton/ReviewDCRButton.js +12 -0
  78. package/features/workflow/ReviewDCRButton/ReviewDCRButton.module.css.js +9 -0
  79. package/features/workflow/ReviewDCRButton/index.d.ts +1 -0
  80. package/features/workflow/ReviewDCRButton/index.js +1 -0
  81. package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.d.ts +11 -0
  82. package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +56 -0
  83. package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.module.css.js +9 -0
  84. package/features/workflow/ReviewDCRDialog/components/DCRChangesSummary/DCRChangesSummary.d.ts +8 -0
  85. package/features/workflow/ReviewDCRDialog/components/DCRChangesSummary/DCRChangesSummary.js +43 -0
  86. package/features/workflow/ReviewDCRDialog/components/DCRChangesSummary/DCRChangesSummary.module.css.js +9 -0
  87. package/features/workflow/ReviewDCRDialog/components/DCRChangesSummary/index.d.ts +1 -0
  88. package/features/workflow/ReviewDCRDialog/components/DCRChangesSummary/index.js +1 -0
  89. package/features/workflow/ReviewDCRDialog/components/DCRSummaryInfo/DCRSummaryInfo.d.ts +9 -0
  90. package/features/workflow/ReviewDCRDialog/components/DCRSummaryInfo/DCRSummaryInfo.js +33 -0
  91. package/features/workflow/ReviewDCRDialog/components/DCRSummaryInfo/DCRSummaryInfo.module.css.js +9 -0
  92. package/features/workflow/ReviewDCRDialog/helpers/calculateDCRChanges.d.ts +3 -0
  93. package/features/workflow/ReviewDCRDialog/helpers/calculateDCRChanges.js +15 -0
  94. package/features/workflow/ReviewDCRDialog/helpers/calculateDCRChanges.test.d.ts +1 -0
  95. package/features/workflow/ReviewDCRDialog/helpers/calculateDCRChanges.test.js +122 -0
  96. package/features/workflow/ReviewDCRDialog/helpers/index.d.ts +1 -0
  97. package/features/workflow/ReviewDCRDialog/helpers/index.js +1 -0
  98. package/features/workflow/ReviewDCRDialog/index.d.ts +1 -0
  99. package/features/workflow/ReviewDCRDialog/index.js +1 -0
  100. package/features/workflow/TaskActionButtons/TaskActionButtons.spec.js +1 -1
  101. package/features/workflow/WorkflowActionButtons/WorkflowActionButtons.d.ts +12 -0
  102. package/features/workflow/WorkflowActionButtons/WorkflowActionButtons.js +27 -0
  103. package/features/workflow/WorkflowActionButtons/index.d.ts +1 -0
  104. package/features/workflow/WorkflowActionButtons/index.js +1 -0
  105. package/features/workflow/WorkflowComments/WorkflowComments.d.ts +7 -1
  106. package/features/workflow/WorkflowComments/WorkflowComments.js +13 -29
  107. package/features/workflow/WorkflowComments/WorkflowComments.module.css.js +9 -0
  108. package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +23 -6
  109. package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.spec.js +82 -7
  110. package/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.d.ts +2 -1
  111. package/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.js +8 -7
  112. package/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.module.css.js +9 -0
  113. package/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.spec.js +125 -3
  114. package/features/workflow/WorkflowTaskCard/components/PotentialMatchTaskCard/PotentialMatchTaskCard.spec.js +71 -5
  115. package/features/workflow/index.d.ts +2 -0
  116. package/features/workflow/index.js +2 -0
  117. package/icons/RequestSummary.d.ts +3 -0
  118. package/icons/RequestSummary.js +19 -0
  119. package/icons/ReviewDCR.d.ts +3 -0
  120. package/icons/ReviewDCR.js +17 -0
  121. package/package.json +2 -2
  122. package/ProfileBand/styles.d.ts +0 -1
  123. package/ProfileBand/styles.js +0 -87
  124. package/cjs/ProfileBand/styles.d.ts +0 -1
  125. package/cjs/ProfileBand/styles.js +0 -90
  126. package/cjs/features/workflow/WorkflowComments/styles.d.ts +0 -1
  127. package/cjs/features/workflow/WorkflowComments/styles.js +0 -42
  128. package/cjs/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/styles.d.ts +0 -3
  129. package/cjs/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/styles.js +0 -113
  130. package/features/workflow/WorkflowComments/styles.d.ts +0 -1
  131. package/features/workflow/WorkflowComments/styles.js +0 -39
  132. package/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/styles.d.ts +0 -3
  133. package/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/styles.js +0 -110
@@ -160,3 +160,4 @@ export var useMdmControlAttributes = function () {
160
160
  return useMdmModuleValuesContext(function (context) { return context.controlAttributes || emptyControlAttributes; });
161
161
  };
162
162
  export var useMdmShowMasking = function () { return useMdmModuleValuesContext(function (context) { return context.showMasking; }); };
163
+ export var useMdmReviewDCREnabled = function () { return useMdmModuleValuesContext(function (context) { return context.reviewDCREnabled; }); };
@@ -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, useMdmAttributesPresentation, useMdmMaxValuesInResponse, 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, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled, useMdmHiddenAttributes, useMdmControlAttributes, useMdmShowMasking } from './hooks';
2
+ export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, 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, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled, useMdmHiddenAttributes, useMdmControlAttributes, useMdmShowMasking, useMdmReviewDCREnabled } 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, useMdmAttributesPresentation, useMdmMaxValuesInResponse, 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, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled, useMdmHiddenAttributes, useMdmControlAttributes, useMdmShowMasking } from './hooks';
2
+ export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, 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, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled, useMdmHiddenAttributes, useMdmControlAttributes, useMdmShowMasking, useMdmReviewDCREnabled } from './hooks';
@@ -1,5 +1,5 @@
1
1
  type Type = {
2
2
  color?: string;
3
3
  };
4
- export declare const useStyles: (props: Type) => import("@mui/styles").ClassNameMap<"title" | "date" | "selected" | "user" | "badge" | "historyRow" | "rowHeader">;
4
+ export declare const useStyles: (props: Type) => import("@mui/styles").ClassNameMap<"title" | "date" | "selected" | "user" | "historyRow" | "rowHeader" | "badge">;
5
5
  export {};
@@ -45,6 +45,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
48
57
  import React from 'react';
49
58
  import { act, render, screen } from '@testing-library/react';
50
59
  import userEvent from '@testing-library/user-event';
@@ -260,4 +269,62 @@ describe('AddWorkflowDialog tests', function () {
260
269
  }
261
270
  });
262
271
  }); });
272
+ describe('Required comments', function () {
273
+ it('should not allow to start workflow if comment is required with empty comment', function () { return __awaiter(void 0, void 0, void 0, function () {
274
+ var definitionsWithRequiredComment, mockAnchorEl, props, user, commentField, startButton, comment;
275
+ return __generator(this, function (_a) {
276
+ switch (_a.label) {
277
+ case 0:
278
+ startProcessInstance.mockResolvedValue(null);
279
+ definitionsWithRequiredComment = __spreadArray(__spreadArray([], definitions, true), [
280
+ {
281
+ type: 'workflowWithRequiredComment',
282
+ displayName: 'Workflow With Required Comment',
283
+ manualStart: true,
284
+ requiresCommentOnStart: true,
285
+ objectTypes: ['configuration/entityTypes/HCO']
286
+ }
287
+ ], false);
288
+ processDefinitions.mockReturnValue(Promise.resolve({
289
+ data: definitionsWithRequiredComment
290
+ }));
291
+ mockAnchorEl = document.createElement('div');
292
+ props = {
293
+ onClose: jest.fn(),
294
+ anchorEl: mockAnchorEl
295
+ };
296
+ user = setUp(props).user;
297
+ expect(screen.getByText('Add new workflow')).toBeInTheDocument();
298
+ return [4 /*yield*/, user.click(screen.getByRole('combobox'))];
299
+ case 1:
300
+ _a.sent();
301
+ return [4 /*yield*/, user.click(screen.getByText('Workflow With Required Comment'))];
302
+ case 2:
303
+ _a.sent();
304
+ commentField = screen.getByRole('textbox', { name: /type a comment/i });
305
+ expect(commentField).toBeRequired();
306
+ startButton = screen.getByText('Start');
307
+ expect(startButton).toBeDisabled();
308
+ comment = 'Some comment';
309
+ return [4 /*yield*/, user.type(commentField, comment)];
310
+ case 3:
311
+ _a.sent();
312
+ expect(startButton).not.toBeDisabled();
313
+ return [4 /*yield*/, user.click(startButton)];
314
+ case 4:
315
+ _a.sent();
316
+ expect(startProcessInstance).toHaveBeenCalledWith({
317
+ workflowPath: workflowPath,
318
+ environment: workflowEnvironmentUrl,
319
+ tenant: tenant.id,
320
+ processType: 'workflowWithRequiredComment',
321
+ comment: comment,
322
+ objectURIs: ['entities/uri1']
323
+ });
324
+ expect(screen.getByText('A new workflow has started')).toBeInTheDocument();
325
+ return [2 /*return*/];
326
+ }
327
+ });
328
+ }); });
329
+ });
263
330
  });
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { ChangeRequest, WorkflowTaskData } from '@reltio/mdm-sdk';
3
+ type Props = {
4
+ dcr: ChangeRequest;
5
+ task: WorkflowTaskData;
6
+ };
7
+ export declare const ChangeRequestEditor: ({ dcr, task: _task }: Props) => React.JSX.Element;
8
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import i18n from 'ui-i18n';
3
+ import styles from './ChangeRequestEditor.module.css';
4
+ export var ChangeRequestEditor = function (_a) {
5
+ var dcr = _a.dcr, _task = _a.task;
6
+ var dcrLoaded = !!dcr;
7
+ if (!dcrLoaded) {
8
+ return null;
9
+ }
10
+ return React.createElement("div", { className: styles.container }, i18n.text('DCR changes'));
11
+ };
@@ -0,0 +1,9 @@
1
+ const styles = {"container":"ChangeRequestEditor-container--pOvfN"};
2
+ if (typeof document !== 'undefined') {
3
+ const head = document.head || document.getElementsByTagName('head')[0]
4
+ const style = document.createElement('style');
5
+ style.type = 'text/css'
6
+ style.innerHTML = `.ChangeRequestEditor-container--pOvfN{border:1px solid rgba(0,0,0,.03);border-radius:8px;padding:16px}`;
7
+ head.appendChild(style);
8
+ }
9
+ export default styles;
@@ -0,0 +1 @@
1
+ export { ChangeRequestEditor } from './ChangeRequestEditor';
@@ -0,0 +1 @@
1
+ export { ChangeRequestEditor } from './ChangeRequestEditor';
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ type Props = {
3
+ onClick: () => void;
4
+ };
5
+ export declare const ReviewDCRButton: ({ onClick }: Props) => React.JSX.Element;
6
+ export {};
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import classnames from 'classnames';
3
+ import Button from '@mui/material/Button';
4
+ import i18n from 'ui-i18n';
5
+ import SvgReviewDCR from '../../../icons/ReviewDCR';
6
+ import styles from './ReviewDCRButton.module.css';
7
+ export var ReviewDCRButton = function (_a) {
8
+ var onClick = _a.onClick;
9
+ return (React.createElement(Button, { onClick: onClick, color: "primary", className: classnames(styles.button), "data-reltio-id": "review-dcr-button" },
10
+ React.createElement(SvgReviewDCR, { className: styles.icon }),
11
+ i18n.text('Review DCR')));
12
+ };
@@ -0,0 +1,9 @@
1
+ const styles = {"button":"ReviewDCRButton-button--LIwmx","icon":"ReviewDCRButton-icon--b1gNO"};
2
+ if (typeof document !== 'undefined') {
3
+ const head = document.head || document.getElementsByTagName('head')[0]
4
+ const style = document.createElement('style');
5
+ style.type = 'text/css'
6
+ style.innerHTML = `.ReviewDCRButton-button--LIwmx{min-width:100px}.ReviewDCRButton-icon--b1gNO{margin-right:8px}`;
7
+ head.appendChild(style);
8
+ }
9
+ export default styles;
@@ -0,0 +1 @@
1
+ export { ReviewDCRButton } from './ReviewDCRButton';
@@ -0,0 +1 @@
1
+ export { ReviewDCRButton } from './ReviewDCRButton';
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { ChangeRequest, GroupedObjectsInfo, WorkflowTaskData } from '@reltio/mdm-sdk';
3
+ type Props = {
4
+ open: boolean;
5
+ onClose: () => void;
6
+ dcr: ChangeRequest;
7
+ task: WorkflowTaskData;
8
+ groupedObjects: GroupedObjectsInfo[];
9
+ };
10
+ export declare const ReviewDCRDialog: ({ open, onClose, dcr, task, groupedObjects }: Props) => React.JSX.Element;
11
+ export {};
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ import Dialog from '@mui/material/Dialog';
3
+ import DialogTitle from '@mui/material/DialogTitle';
4
+ import DialogContent from '@mui/material/DialogContent';
5
+ import Typography from '@mui/material/Typography';
6
+ import { SmallIconButton } from '../../../SmallIconButton';
7
+ import CloseIcon from '@mui/icons-material/Close';
8
+ import i18n from 'ui-i18n';
9
+ import { useWorkflowCheckPermission } from '../hooks/useWorkflowCheckPermission';
10
+ import { useWorkflowActions } from '../hooks/useWorkflowActions';
11
+ import { useMdmEntity } from '../../../contexts/MdmModuleContext';
12
+ import { ProfileBand } from '../../../ProfileBand';
13
+ import { DueDateField } from '../DueDateField';
14
+ import { PrioritySelector } from '../PrioritySelector';
15
+ import { AssigneeSelector } from '../AssigneeSelector';
16
+ import { WorkflowComments } from '../WorkflowComments';
17
+ import { WorkflowActionButtons } from '../WorkflowActionButtons';
18
+ import { DCRSummaryInfo } from './components/DCRSummaryInfo/DCRSummaryInfo';
19
+ import { ChangeRequestEditor } from '../ChangeRequestEditor';
20
+ import styles from './ReviewDCRDialog.module.css';
21
+ export var ReviewDCRDialog = function (_a) {
22
+ var open = _a.open, onClose = _a.onClose, dcr = _a.dcr, task = _a.task, groupedObjects = _a.groupedObjects;
23
+ var entity = useMdmEntity();
24
+ var checkWorkflowPermission = useWorkflowCheckPermission();
25
+ var canViewComments = checkWorkflowPermission('VIEW_PROCESS_INSTANCE_COMMENTS');
26
+ var _b = useWorkflowActions({
27
+ taskId: task.taskId,
28
+ possibleActions: task.possibleActions,
29
+ assignee: task.assignee,
30
+ isOpen: task.isOpen
31
+ }), workflowActions = _b.actions, actionRequestIsInProgress = _b.actionRequestIsInProgress;
32
+ return (React.createElement(Dialog, { open: open, onClose: onClose, fullScreen: true },
33
+ React.createElement(DialogTitle, { className: styles.dialogTitle },
34
+ React.createElement("div", { className: styles.titleContent },
35
+ React.createElement(Typography, { variant: "h6", className: styles.titleText }, i18n.text('Review DCR')),
36
+ React.createElement(WorkflowActionButtons, { workflowActions: workflowActions, actionRequestIsInProgress: actionRequestIsInProgress, preferredAction: task.preferredAction })),
37
+ React.createElement(SmallIconButton, { onClick: onClose, className: styles.closeButton, "aria-label": "close", icon: CloseIcon })),
38
+ React.createElement(DialogContent, { classes: { root: styles.content } },
39
+ React.createElement("div", { className: styles.leftSection },
40
+ React.createElement(ProfileBand, { entity: entity, className: styles.profileBandRoot, classes: { profileBand: styles.profileBand } }),
41
+ React.createElement(DCRSummaryInfo, { dcr: dcr, task: task, groupedObjects: groupedObjects }),
42
+ React.createElement("div", { className: styles.editableSection },
43
+ React.createElement("div", { className: styles.editableGrid },
44
+ React.createElement("div", { className: styles.editableItem },
45
+ React.createElement(DueDateField, { taskId: task.taskId, dueDate: task.dueDate, isTaskOpen: task.isOpen })),
46
+ React.createElement("div", { className: styles.editableItem },
47
+ React.createElement(PrioritySelector, { taskId: task.taskId, priority: task.priority || 50, isTaskOpen: task.isOpen, className: styles.priorityField })),
48
+ React.createElement("div", { className: styles.editableItem },
49
+ React.createElement(AssigneeSelector, { taskId: task.taskId, assignee: task.assignee, isTaskOpen: task.isOpen })))),
50
+ React.createElement("div", { className: styles.changesSection },
51
+ React.createElement(ChangeRequestEditor, { dcr: dcr, task: task }))),
52
+ canViewComments && (React.createElement(WorkflowComments, { workflowActions: workflowActions, actionRequestIsInProgress: actionRequestIsInProgress, preferredAction: task.preferredAction, taskId: task.taskId, processInstanceComments: task.processInstanceComments, isTaskOpen: task.isOpen, showActionButtons: false, alwaysExpanded: true, classes: {
53
+ container: styles.commentsRootContainer,
54
+ commentsContainer: styles.commentsContainer
55
+ } })))));
56
+ };
@@ -0,0 +1,9 @@
1
+ const styles = {"dialogTitle":"ReviewDCRDialog-dialogTitle--xCXtj","titleContent":"ReviewDCRDialog-titleContent--Hh2KH","titleText":"ReviewDCRDialog-titleText--ME8s4","closeButton":"ReviewDCRDialog-closeButton--YMAEf","content":"ReviewDCRDialog-content--qvUva","leftSection":"ReviewDCRDialog-leftSection--5MELW","profileBand":"ReviewDCRDialog-profileBand--7r6Xy","profileBandRoot":"ReviewDCRDialog-profileBandRoot--G7p1m","editableSection":"ReviewDCRDialog-editableSection--v-D7a","editableGrid":"ReviewDCRDialog-editableGrid--auc-d","editableItem":"ReviewDCRDialog-editableItem--isGwv","priorityField":"ReviewDCRDialog-priorityField--LQ1n3","changesSection":"ReviewDCRDialog-changesSection--qj2OK","commentsRootContainer":"ReviewDCRDialog-commentsRootContainer--g2f7m","commentsContainer":"ReviewDCRDialog-commentsContainer--OApOx"};
2
+ if (typeof document !== 'undefined') {
3
+ const head = document.head || document.getElementsByTagName('head')[0]
4
+ const style = document.createElement('style');
5
+ style.type = 'text/css'
6
+ style.innerHTML = `.ReviewDCRDialog-dialogTitle--xCXtj{align-items:center;border-bottom:1px solid #e0e0e0;display:flex;justify-content:space-between;padding:12px 16px 8px}.ReviewDCRDialog-titleContent--Hh2KH{align-items:center;display:flex;flex:1;justify-content:space-between;position:relative}.ReviewDCRDialog-titleText--ME8s4{flex:1;margin:0;padding-left:48px}.ReviewDCRDialog-closeButton--YMAEf{color:#666;left:15px;position:absolute}.ReviewDCRDialog-closeButton--YMAEf:hover{background-color:rgba(0,0,0,.04);color:#333}.ReviewDCRDialog-content--qvUva{display:flex;min-height:400px;padding:0!important;width:100%}.ReviewDCRDialog-leftSection--5MELW{border-right:1px solid #e0e0e0;padding:0 16px;width:100%}.ReviewDCRDialog-profileBand--7r6Xy{margin-left:-16px}.ReviewDCRDialog-profileBandRoot--G7p1m{box-shadow:none;margin-bottom:0}.ReviewDCRDialog-editableSection--v-D7a{border:1px solid #d9d9d9;border-radius:0 0 8px 8px;margin-bottom:32px;padding:8px 16px 14px}.ReviewDCRDialog-editableGrid--auc-d{display:grid;gap:24px;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));margin-bottom:12px}.ReviewDCRDialog-editableItem--isGwv{display:flex;flex-direction:column}.ReviewDCRDialog-priorityField--LQ1n3{min-width:200px}.ReviewDCRDialog-changesSection--qj2OK{margin-bottom:24px}.ReviewDCRDialog-commentsRootContainer--g2f7m{margin:10px 0 16px 10px;min-width:323px;width:323px}.ReviewDCRDialog-commentsContainer--OApOx{flex-grow:1;max-height:100%}`;
7
+ head.appendChild(style);
8
+ }
9
+ export default styles;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { DCRChanges, GroupedObjectsInfo } from '@reltio/mdm-sdk';
3
+ type Props = {
4
+ changes?: DCRChanges;
5
+ groupedObjects: GroupedObjectsInfo[];
6
+ };
7
+ export declare const DCRChangesSummary: ({ changes, groupedObjects }: Props) => React.JSX.Element;
8
+ export {};
@@ -0,0 +1,43 @@
1
+ import React, { useMemo } from 'react';
2
+ import classnames from 'classnames';
3
+ import Skeleton from '@mui/material/Skeleton';
4
+ import i18n from 'ui-i18n';
5
+ import { DCROperationTypes } from '@reltio/mdm-sdk';
6
+ import { useMdmMetadata } from '../../../../../contexts/MdmModuleContext';
7
+ import { calculateDCRChanges } from '../../helpers';
8
+ import styles from './DCRChangesSummary.module.css';
9
+ var getOperationLabel = function (operation) {
10
+ var _a;
11
+ var labels = (_a = {},
12
+ _a[DCROperationTypes.ADDED] = i18n.text('Added'),
13
+ _a[DCROperationTypes.EDITED] = i18n.text('Edited'),
14
+ _a[DCROperationTypes.DELETED] = i18n.text('Deleted'),
15
+ _a[DCROperationTypes.PINNED] = i18n.text('Pinned'),
16
+ _a[DCROperationTypes.PIN_DELETED] = i18n.text('Pin deleted'),
17
+ _a[DCROperationTypes.IGNORED] = i18n.text('Ignored'),
18
+ _a[DCROperationTypes.IGNORE_DELETED] = i18n.text('Ignore deleted'),
19
+ _a);
20
+ return labels[operation] || operation || '';
21
+ };
22
+ var ChangeItem = function (_a) {
23
+ var count = _a.count, operation = _a.operation;
24
+ return count > 0 && (React.createElement("div", { className: styles.changeItem },
25
+ React.createElement("div", { className: classnames(styles.changeNumber, styles[operation]) }, count),
26
+ React.createElement("div", { className: styles.changeLabel }, getOperationLabel(operation))));
27
+ };
28
+ var LoadingSkeleton = function () { return (React.createElement(React.Fragment, null, Array.from({ length: 4 }).map(function (_, index) { return (React.createElement("div", { key: "summary-changes-skeleton-".concat(index), className: styles.changeItem },
29
+ React.createElement(Skeleton, { variant: "text", width: 24, height: 16, className: styles.changeNumber }),
30
+ React.createElement(Skeleton, { variant: "text", width: 60, height: 13, className: styles.changeLabel }))); }))); };
31
+ export var DCRChangesSummary = function (_a) {
32
+ var changes = _a.changes, groupedObjects = _a.groupedObjects;
33
+ var metadata = useMdmMetadata();
34
+ var dcrChanges = useMemo(function () { return (changes ? calculateDCRChanges(metadata, changes, groupedObjects) : null); }, [metadata, changes, groupedObjects]);
35
+ var changesLoaded = !!dcrChanges;
36
+ return (React.createElement("div", { className: styles.changesSummary, "data-reltio-id": "dcr-changes-summary" },
37
+ !changesLoaded && React.createElement(LoadingSkeleton, null),
38
+ changesLoaded &&
39
+ Object.entries(dcrChanges).map(function (_a) {
40
+ var operation = _a[0], count = _a[1];
41
+ return (React.createElement(ChangeItem, { key: operation, count: count, operation: operation }));
42
+ })));
43
+ };
@@ -0,0 +1,9 @@
1
+ const styles = {"changesSummary":"DCRChangesSummary-changesSummary--31gR-","changeItem":"DCRChangesSummary-changeItem---XfYP","changeNumber":"DCRChangesSummary-changeNumber--vZxc4","changeLabel":"DCRChangesSummary-changeLabel--tDXS6","edited":"DCRChangesSummary-edited--KFivZ","added":"DCRChangesSummary-added--KGdGw","deleted":"DCRChangesSummary-deleted--TWgS5","ignored":"DCRChangesSummary-ignored--Q2Q8R"};
2
+ if (typeof document !== 'undefined') {
3
+ const head = document.head || document.getElementsByTagName('head')[0]
4
+ const style = document.createElement('style');
5
+ style.type = 'text/css'
6
+ style.innerHTML = `.DCRChangesSummary-changesSummary--31gR-{align-items:center;display:flex;gap:22px}.DCRChangesSummary-changeItem---XfYP{align-items:center;display:flex;flex-direction:column;gap:4px;position:relative}.DCRChangesSummary-changeItem---XfYP:not(:last-child):after{background-color:#d9d9d9;bottom:2px;content:"";height:20px;position:absolute;right:-12px;top:2px;width:1px}.DCRChangesSummary-changeNumber--vZxc4{font-size:16px;font-weight:500;line-height:1}.DCRChangesSummary-changeLabel--tDXS6{color:var(--mui-palette-text-primary);font-size:13px}.DCRChangesSummary-edited--KFivZ{color:#eb9d08}.DCRChangesSummary-added--KGdGw{color:#599e0e}.DCRChangesSummary-deleted--TWgS5{color:#eb5757}.DCRChangesSummary-ignored--Q2Q8R{color:var(--mui-palette-primary-light)}`;
7
+ head.appendChild(style);
8
+ }
9
+ export default styles;
@@ -0,0 +1 @@
1
+ export { DCRChangesSummary } from './DCRChangesSummary';
@@ -0,0 +1 @@
1
+ export { DCRChangesSummary } from './DCRChangesSummary';
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ChangeRequest, GroupedObjectsInfo, WorkflowTaskData } from '@reltio/mdm-sdk';
3
+ type Props = {
4
+ dcr: ChangeRequest;
5
+ task: WorkflowTaskData;
6
+ groupedObjects: GroupedObjectsInfo[];
7
+ };
8
+ export declare const DCRSummaryInfo: ({ dcr, task, groupedObjects }: Props) => React.JSX.Element;
9
+ export {};
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import classnames from 'classnames';
3
+ import Typography from '@mui/material/Typography';
4
+ import i18n from 'ui-i18n';
5
+ import SvgRequestSummary from '../../../../../icons/RequestSummary';
6
+ import { DCRChangesSummary } from '../DCRChangesSummary';
7
+ import { getDCRId } from '../../../helpers/common';
8
+ import styles from './DCRSummaryInfo.module.css';
9
+ export var DCRSummaryInfo = function (_a) {
10
+ var dcr = _a.dcr, task = _a.task, groupedObjects = _a.groupedObjects;
11
+ var dcrId = getDCRId(task.objectURIs);
12
+ return (React.createElement("div", { className: styles.requestSummary },
13
+ React.createElement("div", { className: styles.summaryLeft },
14
+ React.createElement("div", { className: styles.summaryIcon },
15
+ React.createElement(SvgRequestSummary, null)),
16
+ React.createElement("div", { className: styles.summaryContent },
17
+ React.createElement(Typography, { variant: "h6", className: styles.summaryTitle }, i18n.text('Request Summary')),
18
+ React.createElement("div", { className: styles.summaryDetails },
19
+ React.createElement("div", { className: styles.summaryItem },
20
+ React.createElement("span", { className: styles.summaryItemName }, "".concat(i18n.text('DCR ID'), ": ")),
21
+ dcrId),
22
+ React.createElement("div", { className: styles.summaryItem },
23
+ React.createElement("span", { className: styles.summaryItemName }, "".concat(i18n.text('Created by'), ": ")),
24
+ task.createdBy),
25
+ React.createElement("div", { className: classnames(styles.summaryItem, styles.summaryItemDate) },
26
+ React.createElement("span", { className: styles.summaryItemName }, "".concat(i18n.text('on'), " ")),
27
+ i18n.date(task.createTime, 'L')),
28
+ React.createElement("div", { className: styles.summaryItem },
29
+ React.createElement("span", { className: styles.summaryItemName }, "".concat(i18n.text('Step'), ": ")),
30
+ task.displayName)))),
31
+ React.createElement("div", { className: styles.summaryRight },
32
+ React.createElement(DCRChangesSummary, { changes: dcr === null || dcr === void 0 ? void 0 : dcr.changes, groupedObjects: groupedObjects }))));
33
+ };
@@ -0,0 +1,9 @@
1
+ const styles = {"requestSummary":"DCRSummaryInfo-requestSummary--FUaA0","summaryLeft":"DCRSummaryInfo-summaryLeft--Y79jA","summaryIcon":"DCRSummaryInfo-summaryIcon--VlZsg","summaryContent":"DCRSummaryInfo-summaryContent--BdPl7","summaryTitle":"DCRSummaryInfo-summaryTitle--77exU","summaryDetails":"DCRSummaryInfo-summaryDetails--u5ije","summaryItem":"DCRSummaryInfo-summaryItem--DbTdR","summaryItemName":"DCRSummaryInfo-summaryItemName--l7hYO","summaryItemDate":"DCRSummaryInfo-summaryItemDate--EQpJ0","summaryRight":"DCRSummaryInfo-summaryRight--9pEaH"};
2
+ if (typeof document !== 'undefined') {
3
+ const head = document.head || document.getElementsByTagName('head')[0]
4
+ const style = document.createElement('style');
5
+ style.type = 'text/css'
6
+ style.innerHTML = `.DCRSummaryInfo-requestSummary--FUaA0{align-items:flex-start;background-color:rgba(0,0,0,.03);border-radius:8px;display:flex;justify-content:space-between;padding:16px 8px 12px}.DCRSummaryInfo-summaryLeft--Y79jA{align-items:flex-start;display:flex;gap:16px}.DCRSummaryInfo-summaryIcon--VlZsg{padding-top:4px}.DCRSummaryInfo-summaryContent--BdPl7{display:flex;flex-direction:column;gap:3px}.DCRSummaryInfo-summaryTitle--77exU{font-size:16px;font-weight:500;margin:0}.DCRSummaryInfo-summaryDetails--u5ije{display:flex;flex-wrap:wrap;font-size:12px;gap:8px}.DCRSummaryInfo-summaryItem--DbTdR{color:var(--mui-palette-text-primary);font-size:13px;margin:0}.DCRSummaryInfo-summaryItemName--l7hYO{color:var(--mui-palette-text-secondary)}.DCRSummaryInfo-summaryItemDate--EQpJ0{margin-left:-4px}.DCRSummaryInfo-summaryRight--9pEaH{align-items:center;display:flex;padding:3px 9px}`;
7
+ head.appendChild(style);
8
+ }
9
+ export default styles;
@@ -0,0 +1,3 @@
1
+ import { DCROperationTypes, DCRChanges, GroupedObjectsInfo, Metadata } from '@reltio/mdm-sdk';
2
+ export type DCRChangeCounts = Partial<Record<DCROperationTypes, number>>;
3
+ export declare const calculateDCRChanges: (metadata: Metadata, changes: DCRChanges, groupedObjects: GroupedObjectsInfo[]) => DCRChangeCounts;
@@ -0,0 +1,15 @@
1
+ import { mergeChanges } from '../../AttributesChanges/helpers/merge';
2
+ export var calculateDCRChanges = function (metadata, changes, groupedObjects) {
3
+ var mergedChanges = groupedObjects.reduce(function (mergedChanges, object) {
4
+ var _a = mergeChanges(metadata, changes, object.entity, object.relations), mergedEntityChanges = _a[0], mergedRelationsChanges = _a[1];
5
+ return mergedChanges.concat(mergedEntityChanges).concat(mergedRelationsChanges);
6
+ }, []);
7
+ var changesCounts = mergedChanges.reduce(function (changesCounts, _a) {
8
+ var operation = _a.operation;
9
+ if (operation) {
10
+ changesCounts[operation] = (changesCounts[operation] || 0) + 1;
11
+ }
12
+ return changesCounts;
13
+ }, {});
14
+ return changesCounts;
15
+ };
@@ -0,0 +1,122 @@
1
+ import { calculateDCRChanges } from './calculateDCRChanges';
2
+ import { DCRTypes } from '@reltio/mdm-sdk';
3
+ describe('calculateDCRChanges', function () {
4
+ var metadata = {
5
+ entityTypes: [
6
+ {
7
+ uri: 'configuration/entityTypes/HCP',
8
+ label: 'HCP',
9
+ attributes: [
10
+ {
11
+ label: 'Name',
12
+ name: 'Name',
13
+ type: 'String',
14
+ uri: 'configuration/entityTypes/HCP/attributes/Name'
15
+ },
16
+ {
17
+ label: 'City',
18
+ name: 'City',
19
+ type: 'String',
20
+ uri: 'configuration/entityTypes/HCP/attributes/City'
21
+ },
22
+ {
23
+ label: 'Tags',
24
+ name: 'Tags',
25
+ type: 'String',
26
+ uri: 'configuration/entityTypes/HCP/attributes/Tags'
27
+ }
28
+ ]
29
+ }
30
+ ]
31
+ };
32
+ var groupedObjects = [
33
+ {
34
+ entity: {
35
+ uri: 'entities/123',
36
+ label: 'Entity 123',
37
+ type: 'configuration/entityTypes/HCP',
38
+ isExist: true,
39
+ secondaryLabel: 'Test Secondary Label'
40
+ },
41
+ relations: []
42
+ }
43
+ ];
44
+ it('should count "added" changes correctly', function () {
45
+ var changes = {
46
+ 'entities/123': [
47
+ {
48
+ id: 'change1',
49
+ type: DCRTypes.UPDATE_TAGS,
50
+ oldValue: ['tag1', 'tag2'],
51
+ newValue: ['tag1', 'tag2', 'tag3']
52
+ },
53
+ {
54
+ id: 'change2',
55
+ type: DCRTypes.UPDATE_ROLES,
56
+ oldValue: ['role1'],
57
+ newValue: ['role1', 'role2']
58
+ },
59
+ {
60
+ id: 'change3',
61
+ attributePath: 'Name',
62
+ type: DCRTypes.INSERT_ATTRIBUTE,
63
+ objectType: 'configuration/entityTypes/HCP',
64
+ newValue: {
65
+ value: {
66
+ Name: [{ value: 'John' }]
67
+ }
68
+ }
69
+ }
70
+ ]
71
+ };
72
+ var result = calculateDCRChanges(metadata, changes, groupedObjects);
73
+ expect(result).toEqual({
74
+ added: 3
75
+ });
76
+ });
77
+ it('should count multiple change types correctly', function () {
78
+ var changes = {
79
+ 'entities/123': [
80
+ {
81
+ id: 'change1',
82
+ type: DCRTypes.UPDATE_TAGS,
83
+ oldValue: ['tag1'],
84
+ newValue: ['tag1', 'tag2', 'tag3']
85
+ },
86
+ {
87
+ id: 'change2',
88
+ type: DCRTypes.UPDATE_ROLES,
89
+ oldValue: ['role1', 'role2'],
90
+ newValue: ['role1']
91
+ },
92
+ {
93
+ id: 'change3',
94
+ attributePath: 'City',
95
+ type: DCRTypes.INSERT_ATTRIBUTE,
96
+ objectType: 'configuration/entityTypes/HCP',
97
+ newValue: { value: { City: [{ value: 'New York' }] } }
98
+ },
99
+ {
100
+ id: 'change4',
101
+ attributePath: 'Name/21vmKank',
102
+ attributeType: 'configuration/entityTypes/HCP/attributes/Name',
103
+ type: DCRTypes.UPDATE_ATTRIBUTE,
104
+ objectType: 'configuration/entityTypes/HCP',
105
+ oldValue: { value: 'John' },
106
+ newValue: { value: 'Mike' }
107
+ }
108
+ ]
109
+ };
110
+ var result = calculateDCRChanges(metadata, changes, groupedObjects);
111
+ expect(result).toEqual({
112
+ added: 2,
113
+ deleted: 1,
114
+ edited: 1
115
+ });
116
+ });
117
+ it('should handle empty changes', function () {
118
+ var changes = {};
119
+ var result = calculateDCRChanges(metadata, changes, groupedObjects);
120
+ expect(result).toEqual({});
121
+ });
122
+ });
@@ -0,0 +1 @@
1
+ export { calculateDCRChanges, type DCRChangeCounts } from './calculateDCRChanges';
@@ -0,0 +1 @@
1
+ export { calculateDCRChanges } from './calculateDCRChanges';
@@ -0,0 +1 @@
1
+ export { ReviewDCRDialog } from './ReviewDCRDialog';
@@ -0,0 +1 @@
1
+ export { ReviewDCRDialog } from './ReviewDCRDialog';
@@ -134,7 +134,7 @@ describe('TaskActionButtons tests', function () {
134
134
  }
135
135
  });
136
136
  }); });
137
- describe('required comments', function () {
137
+ describe('Required comments', function () {
138
138
  it('should show comment dialog if commentRequired is true', function () { return __awaiter(void 0, void 0, void 0, function () {
139
139
  var task, user, dialog, textfield;
140
140
  return __generator(this, function (_a) {
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { TaskAction } from '../types';
3
+ type Props = {
4
+ workflowActions: TaskAction[];
5
+ actionRequestIsInProgress?: boolean;
6
+ preferredAction?: {
7
+ label: string;
8
+ };
9
+ comment?: string;
10
+ };
11
+ export declare const WorkflowActionButtons: ({ workflowActions: actions, actionRequestIsInProgress, preferredAction, comment }: Props) => React.JSX.Element;
12
+ export {};
@@ -0,0 +1,27 @@
1
+ import React, { useMemo, useState } from 'react';
2
+ import Button from '@mui/material/Button';
3
+ import { ModeSwitcherSelect } from '../../../ModeSwitcherSelect';
4
+ export var WorkflowActionButtons = function (_a) {
5
+ var actions = _a.workflowActions, actionRequestIsInProgress = _a.actionRequestIsInProgress, preferredAction = _a.preferredAction, _b = _a.comment, comment = _b === void 0 ? '' : _b;
6
+ var _c = useState(function () { var _a; return (preferredAction === null || preferredAction === void 0 ? void 0 : preferredAction.label) || ((_a = actions[0]) === null || _a === void 0 ? void 0 : _a.text); }), currentAction = _c[0], setCurrentAction = _c[1];
7
+ var buttonsGroup = useMemo(function () {
8
+ return actions.map(function (_a) {
9
+ var text = _a.text, onClick = _a.onClick;
10
+ return ({
11
+ label: text,
12
+ onClick: function () {
13
+ setCurrentAction(text);
14
+ onClick(comment);
15
+ },
16
+ value: text
17
+ });
18
+ });
19
+ }, [actions, comment]);
20
+ if (buttonsGroup.length === 0) {
21
+ return null;
22
+ }
23
+ if (buttonsGroup.length === 1) {
24
+ return (React.createElement(Button, { variant: "outlined", onClick: buttonsGroup[0].onClick, disabled: actionRequestIsInProgress, size: "small" }, buttonsGroup[0].label));
25
+ }
26
+ return (React.createElement(ModeSwitcherSelect, { buttonsGroup: buttonsGroup, value: currentAction, loading: actionRequestIsInProgress, disabled: actionRequestIsInProgress }));
27
+ };