@reltio/components 1.4.2253 → 1.4.2255

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 (81) hide show
  1. package/ActivenessDateControl/ActivenessDateControl.d.ts +3 -1
  2. package/ActivenessDateControl/ActivenessDateControl.js +2 -2
  3. package/ConfigureColumnsPopup/ConfigureColumnsPopup.d.ts +3 -3
  4. package/ConfigureColumnsPopup/ConfigureColumnsPopup.js +5 -5
  5. package/SelectionPopup/SelectionPopup.d.ts +4 -4
  6. package/SelectionPopup/SelectionPopup.js +4 -3
  7. package/SelectionPopup/SelectionPopup.spec.js +2 -2
  8. package/cjs/ActivenessDateControl/ActivenessDateControl.d.ts +3 -1
  9. package/cjs/ActivenessDateControl/ActivenessDateControl.js +2 -2
  10. package/cjs/ConfigureColumnsPopup/ConfigureColumnsPopup.d.ts +3 -3
  11. package/cjs/ConfigureColumnsPopup/ConfigureColumnsPopup.js +5 -5
  12. package/cjs/SelectionPopup/SelectionPopup.d.ts +4 -4
  13. package/cjs/SelectionPopup/SelectionPopup.js +4 -3
  14. package/cjs/SelectionPopup/SelectionPopup.spec.js +2 -2
  15. package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +22 -6
  16. package/cjs/features/workflow/ChangeRequestEditor/helpers/addedAttributes.js +5 -2
  17. package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.js +29 -13
  18. package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test-data.d.ts +41 -0
  19. package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test-data.js +161 -0
  20. package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test.js +52 -0
  21. package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +1 -1
  22. package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.js +2 -4
  23. package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.d.ts +2 -1
  24. package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +37 -3
  25. package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +2 -2
  26. package/cjs/features/workflow/contexts/AddedAttributesContext/index.d.ts +1 -0
  27. package/cjs/features/workflow/contexts/AddedAttributesContext/index.js +8 -3
  28. package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +1 -0
  29. package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.js +8 -2
  30. package/cjs/features/workflow/helpers/attributes.js +5 -4
  31. package/cjs/features/workflow/helpers/attributes.test.js +55 -0
  32. package/cjs/features/workflow/helpers/common.d.ts +2 -1
  33. package/cjs/features/workflow/helpers/common.js +5 -1
  34. package/cjs/features/workflow/helpers/dcr.js +2 -1
  35. package/cjs/features/workflow/helpers/dcr.test.js +47 -0
  36. package/cjs/features/workflow/helpers/merge.js +1 -1
  37. package/cjs/features/workflow/helpers/merge.test.js +34 -0
  38. package/cjs/features/workflow/helpers/metadata.test-data.js +9 -0
  39. package/cjs/features/workflow/helpers/validation.js +3 -2
  40. package/cjs/features/workflow/helpers/validation.test-data.d.ts +1 -0
  41. package/cjs/features/workflow/helpers/validation.test-data.js +34 -1
  42. package/cjs/features/workflow/helpers/validation.test.js +10 -0
  43. package/cjs/features/workflow/hooks/useChangeRequest.d.ts +1 -0
  44. package/cjs/features/workflow/hooks/useChangeRequest.js +8 -5
  45. package/cjs/features/workflow/hooks/useChangeRequest.test.js +11 -5
  46. package/cjs/features/workflow/hooks/useWorkflowActions.d.ts +2 -1
  47. package/cjs/features/workflow/hooks/useWorkflowActions.js +8 -3
  48. package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +23 -7
  49. package/features/workflow/ChangeRequestEditor/helpers/addedAttributes.js +5 -2
  50. package/features/workflow/ChangeRequestEditor/helpers/changesList.js +29 -13
  51. package/features/workflow/ChangeRequestEditor/helpers/changesList.test-data.d.ts +41 -0
  52. package/features/workflow/ChangeRequestEditor/helpers/changesList.test-data.js +153 -0
  53. package/features/workflow/ChangeRequestEditor/helpers/changesList.test.js +52 -0
  54. package/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +1 -1
  55. package/features/workflow/ChangeRequestEditor/helpers/helpers.js +1 -3
  56. package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.d.ts +2 -1
  57. package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +14 -3
  58. package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +2 -2
  59. package/features/workflow/contexts/AddedAttributesContext/index.d.ts +1 -0
  60. package/features/workflow/contexts/AddedAttributesContext/index.js +8 -3
  61. package/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +1 -0
  62. package/features/workflow/contexts/ChangeRequestEditorContext/index.js +8 -2
  63. package/features/workflow/helpers/attributes.js +5 -4
  64. package/features/workflow/helpers/attributes.test.js +55 -0
  65. package/features/workflow/helpers/common.d.ts +2 -1
  66. package/features/workflow/helpers/common.js +3 -0
  67. package/features/workflow/helpers/dcr.js +2 -1
  68. package/features/workflow/helpers/dcr.test.js +47 -0
  69. package/features/workflow/helpers/merge.js +2 -2
  70. package/features/workflow/helpers/merge.test.js +34 -0
  71. package/features/workflow/helpers/metadata.test-data.js +9 -0
  72. package/features/workflow/helpers/validation.js +3 -2
  73. package/features/workflow/helpers/validation.test-data.d.ts +1 -0
  74. package/features/workflow/helpers/validation.test-data.js +32 -0
  75. package/features/workflow/helpers/validation.test.js +11 -1
  76. package/features/workflow/hooks/useChangeRequest.d.ts +1 -0
  77. package/features/workflow/hooks/useChangeRequest.js +8 -5
  78. package/features/workflow/hooks/useChangeRequest.test.js +11 -5
  79. package/features/workflow/hooks/useWorkflowActions.d.ts +2 -1
  80. package/features/workflow/hooks/useWorkflowActions.js +8 -3
  81. package/package.json +2 -2
@@ -261,5 +261,14 @@ export var getMetadata = function () { return ({
261
261
  }
262
262
  ]
263
263
  }
264
+ ],
265
+ roles: [
266
+ {
267
+ uri: 'configuration/roles/DirectorofNursing',
268
+ label: 'Director of Nursing',
269
+ description: 'Director of Nursing'
270
+ },
271
+ { uri: 'configuration/roles/MedicalAssistant', label: 'Medical Assistant', description: 'Medical Assistant' },
272
+ { uri: 'configuration/roles/LabDirectors', label: 'Lab Directors', description: 'Lab Directors' }
264
273
  ]
265
274
  }); };
@@ -21,6 +21,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
21
21
  import { clone } from 'ramda';
22
22
  import i18n from 'ui-i18n';
23
23
  import { findAttributeTypeByUri, DCRTypes, getRequiredAttributeTypesByTypeUri, buildError, ErrorType, getParentUri, findAttributeValuesByTypeUri, isEmptyValue, isOv, isIgnored, ErrorSource, evaluateErrorPath, isReference } from '@reltio/mdm-sdk';
24
+ import { isPrimitiveValue } from './common';
24
25
  var ALLOWED_CHANGE_TYPES = [
25
26
  DCRTypes.UPDATE_ATTRIBUTE,
26
27
  DCRTypes.INSERT_ATTRIBUTE,
@@ -256,7 +257,7 @@ var validateRequiredComplexAttributes = function (_a) {
256
257
  return [];
257
258
  }
258
259
  var valueHolder = change.type === DCRTypes.CREATE_ENTITY || change.type === DCRTypes.CREATE_RELATIONSHIP ? 'attributes' : 'value';
259
- var rootAttributeTypeUri = change.refAttributeType || change.attributeType || change.objectType;
260
+ var rootAttributeTypeUri = change.attributeType || change.refAttributeType || change.objectType;
260
261
  if (!rootAttributeTypeUri) {
261
262
  return [];
262
263
  }
@@ -286,7 +287,7 @@ var validateRequiredComplexAttributes = function (_a) {
286
287
  var errors = [];
287
288
  var visitValue = function (value, path) {
288
289
  var isRejected = checkIsChangeRejected(path.slice(0, -1).join('/'));
289
- if (typeof value === 'string') {
290
+ if (isPrimitiveValue(value)) {
290
291
  return !isRejected;
291
292
  }
292
293
  if (isRejected) {
@@ -10,5 +10,6 @@ export declare const getUserChanges: () => UserChange[];
10
10
  export declare const getUserChangesRejectSubnestedAttributes: () => UserChange[];
11
11
  export declare const getUserChangesRejectSubnestedRelationAttributes: () => UserChange[];
12
12
  export declare const getUserChangesSubnestedEmpty: () => UserChange[];
13
+ export declare const getChangesWithBooleanPrimitiveValue: () => DCRChanges;
13
14
  export declare const getUserChangesNewEntity: () => UserChange[];
14
15
  export {};
@@ -478,6 +478,38 @@ export var getUserChangesSubnestedEmpty = function () { return [
478
478
  }
479
479
  }
480
480
  ]; };
481
+ export var getChangesWithBooleanPrimitiveValue = function () { return ({
482
+ 'entities/entityUri1': [
483
+ {
484
+ id: '0SBn7Oa',
485
+ type: DCRTypes.INSERT_ATTRIBUTE,
486
+ createdTime: 1761922840650,
487
+ createdBy: 'ivan.kositsin',
488
+ objectType: 'configuration/entityTypes/HCP',
489
+ attributePath: 'Specialities',
490
+ newValue: {
491
+ value: {
492
+ SpecialityStatus: [
493
+ {
494
+ value: 'ACTIVE'
495
+ }
496
+ ],
497
+ PrimarySpecialityInd: [
498
+ {
499
+ value: false
500
+ }
501
+ ]
502
+ }
503
+ },
504
+ crosswalk: {
505
+ type: 'configuration/sources/Reltio',
506
+ value: 'entityUri1'
507
+ },
508
+ newPinOrIgnoreValue: false,
509
+ attributeType: 'configuration/entityTypes/HCP/attributes/Specialities'
510
+ }
511
+ ]
512
+ }); };
481
513
  export var getUserChangesNewEntity = function () { return [
482
514
  {
483
515
  lineId: 'entityUri2/0IEiwoe/newValue/attributes/Name/0',
@@ -1,6 +1,6 @@
1
1
  import { getValidationErrors } from './validation';
2
2
  import { getMetadata } from './metadata.test-data';
3
- import { getChanges, getEntitiesOrRelations, getUserChanges, getUserChangesRejectSubnestedAttributes, getUserChangesRejectSubnestedRelationAttributes, getUserChangesSubnestedEmpty, getUserChangesNewEntity } from './validation.test-data';
3
+ import { getChanges, getChangesWithBooleanPrimitiveValue, getEntitiesOrRelations, getUserChanges, getUserChangesRejectSubnestedAttributes, getUserChangesRejectSubnestedRelationAttributes, getUserChangesSubnestedEmpty, getUserChangesNewEntity } from './validation.test-data';
4
4
  import { findAttributeTypeByUri } from '@reltio/mdm-sdk';
5
5
  describe('getValidationErrors', function () {
6
6
  it('should validate required attributes with user changes', function () {
@@ -213,6 +213,16 @@ describe('getValidationErrors', function () {
213
213
  }
214
214
  ]);
215
215
  });
216
+ it('should not report a missing required boolean attribute when its value is primitive false', function () {
217
+ var metadata = getMetadata();
218
+ var result = getValidationErrors({
219
+ changes: getChangesWithBooleanPrimitiveValue(),
220
+ userChanges: [],
221
+ entitiesOrRelations: getEntitiesOrRelations(),
222
+ metadata: metadata
223
+ });
224
+ expect(result).toEqual([]);
225
+ });
216
226
  it('should validate required attributes in new entity', function () {
217
227
  var metadata = getMetadata();
218
228
  var result = getValidationErrors({
@@ -2,4 +2,5 @@ import { ChangeRequest, GroupedObjectsInfo } from '@reltio/mdm-sdk';
2
2
  export declare const useChangeRequest: (dcrUri: string) => {
3
3
  dcr: ChangeRequest;
4
4
  groupedObjects: GroupedObjectsInfo[];
5
+ reloadDcr: () => void;
5
6
  };
@@ -25,8 +25,8 @@ export var useChangeRequest = function (dcrUri) {
25
25
  }
26
26
  return safePromise(getEntitiesByUris(entityUris, { searchOptions: 'ovOnly', defaultMaxValues: 1 }));
27
27
  }, []); // eslint-disable-line
28
- useEffect(function () {
29
- getDataChangeRequest(dcrUri)
28
+ var loadDcr = useCallback(function () {
29
+ safePromise(getDataChangeRequest(dcrUri))
30
30
  .then(function (dcr) {
31
31
  var changes = dcr.changes, objectsInfo = dcr.objectsInfo;
32
32
  var objectsWithChanges = extractObjectsFromChangeRequest(changes, objectsInfo);
@@ -37,7 +37,7 @@ export var useChangeRequest = function (dcrUri) {
37
37
  requestEntities(entityUris)
38
38
  .then(function (entities) {
39
39
  var relationsObjectsWithRequestedEntities = relationsObjectsWithoutEntity.map(function (relationsObject, index) {
40
- return __assign(__assign({}, relationsObject), { entity: entities[index] });
40
+ return __assign(__assign({}, relationsObject), { entity: __assign(__assign({}, entities[index]), { isExist: true }) });
41
41
  });
42
42
  pipe(flatten, reduce(concatEntityRelationsObjects, {}), values, setGroupedObjects)([
43
43
  entityObjectsWithRelations,
@@ -49,6 +49,9 @@ export var useChangeRequest = function (dcrUri) {
49
49
  setDcr(dcr);
50
50
  })
51
51
  .catch(showErrorMessage);
52
- }, [dcrUri, requestEntities]);
53
- return { dcr: dcr, groupedObjects: groupedObjects };
52
+ }, [dcrUri, requestEntities, safePromise]);
53
+ useEffect(function () {
54
+ loadDcr();
55
+ }, [loadDcr]);
56
+ return { dcr: dcr, groupedObjects: groupedObjects, reloadDcr: loadDcr };
54
57
  };
@@ -127,7 +127,8 @@ describe('useChangeRequest tests', function () {
127
127
  expect(getEntitiesByUris).not.toHaveBeenCalled();
128
128
  expect(result.current).toEqual({
129
129
  dcr: null,
130
- groupedObjects: []
130
+ groupedObjects: [],
131
+ reloadDcr: expect.any(Function)
131
132
  });
132
133
  });
133
134
  it('should return empty parameters if dcrUri is undefined', function () {
@@ -136,7 +137,8 @@ describe('useChangeRequest tests', function () {
136
137
  expect(getEntitiesByUris).not.toHaveBeenCalled();
137
138
  expect(result.current).toEqual({
138
139
  dcr: null,
139
- groupedObjects: []
140
+ groupedObjects: [],
141
+ reloadDcr: expect.any(Function)
140
142
  });
141
143
  });
142
144
  it('should go to error message in case of getDataChangeRequest error', function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -159,7 +161,8 @@ describe('useChangeRequest tests', function () {
159
161
  });
160
162
  expect(result.current).toEqual({
161
163
  dcr: null,
162
- groupedObjects: []
164
+ groupedObjects: [],
165
+ reloadDcr: expect.any(Function)
163
166
  });
164
167
  return [2 /*return*/];
165
168
  }
@@ -198,7 +201,8 @@ describe('useChangeRequest tests', function () {
198
201
  });
199
202
  expect(result.current).toEqual({
200
203
  dcr: dcr,
201
- groupedObjects: []
204
+ groupedObjects: [],
205
+ reloadDcr: expect.any(Function)
202
206
  });
203
207
  return [2 /*return*/];
204
208
  }
@@ -234,6 +238,7 @@ describe('useChangeRequest tests', function () {
234
238
  expect(ErrorPopup.addError).not.toHaveBeenCalled();
235
239
  expect(result.current).toEqual({
236
240
  dcr: dcr,
241
+ reloadDcr: expect.any(Function),
237
242
  groupedObjects: [
238
243
  {
239
244
  entity: {
@@ -267,7 +272,8 @@ describe('useChangeRequest tests', function () {
267
272
  },
268
273
  {
269
274
  entity: {
270
- uri: 'entities/151gdPs5'
275
+ uri: 'entities/151gdPs5',
276
+ isExist: true
271
277
  },
272
278
  relations: [
273
279
  {
@@ -4,9 +4,10 @@ type Task = Partial<Pick<WorkflowTaskData, 'taskId' | 'possibleActions' | 'assig
4
4
  type Props = {
5
5
  task: Task;
6
6
  onActionSuccess?: (action: string) => void;
7
+ onError?: () => void;
7
8
  beforeAction?: () => Promise<BeforeActionOutcome>;
8
9
  };
9
- export declare const useWorkflowActions: ({ task, onActionSuccess, beforeAction }: Props) => {
10
+ export declare const useWorkflowActions: ({ task, onActionSuccess, onError, beforeAction }: Props) => {
10
11
  actions: TaskAction[];
11
12
  actionRequestIsInProgress: boolean;
12
13
  };
@@ -43,7 +43,7 @@ import { useMdmTenant, useMdmUsername, useMdmWorkflowEnvironmentUrl, useMdmWorkf
43
43
  import { useCommentDialog } from '../../../contexts/CommentDialogContext';
44
44
  import { showDefaultErrorMessage } from '../../../helpers/errors';
45
45
  export var useWorkflowActions = function (_a) {
46
- var task = _a.task, onActionSuccess = _a.onActionSuccess, beforeAction = _a.beforeAction;
46
+ var task = _a.task, onActionSuccess = _a.onActionSuccess, onError = _a.onError, beforeAction = _a.beforeAction;
47
47
  var _b = task !== null && task !== void 0 ? task : {}, possibleActions = _b.possibleActions, assignee = _b.assignee, taskId = _b.taskId, isOpen = _b.isOpen;
48
48
  var workflowTasks = useContext(WorkflowTasksContext);
49
49
  var workflowPath = useMdmWorkflowPath();
@@ -82,6 +82,7 @@ export var useWorkflowActions = function (_a) {
82
82
  if (!outcome.proceed) {
83
83
  if (outcome.error) {
84
84
  showDefaultErrorMessage(outcome.error);
85
+ onError === null || onError === void 0 ? void 0 : onError();
85
86
  }
86
87
  setActionRequestIsInProgress(false);
87
88
  return [2 /*return*/];
@@ -90,6 +91,7 @@ export var useWorkflowActions = function (_a) {
90
91
  case 5:
91
92
  error_1 = _a.sent();
92
93
  showDefaultErrorMessage(error_1);
94
+ onError === null || onError === void 0 ? void 0 : onError();
93
95
  setActionRequestIsInProgress(false);
94
96
  return [2 /*return*/];
95
97
  case 6:
@@ -104,7 +106,10 @@ export var useWorkflowActions = function (_a) {
104
106
  .then(function () {
105
107
  handleActionSuccess === null || handleActionSuccess === void 0 ? void 0 : handleActionSuccess(action);
106
108
  })
107
- .catch(showWorkflowError)
109
+ .catch(function (error) {
110
+ showWorkflowError(error);
111
+ onError === null || onError === void 0 ? void 0 : onError();
112
+ })
108
113
  .finally(function () {
109
114
  setActionRequestIsInProgress(false);
110
115
  });
@@ -113,7 +118,7 @@ export var useWorkflowActions = function (_a) {
113
118
  }
114
119
  });
115
120
  }); };
116
- }, [workflowPath, taskId, environment, tenant, handleActionSuccess, showCommentDialog, beforeAction]);
121
+ }, [workflowPath, taskId, environment, tenant, handleActionSuccess, showCommentDialog, beforeAction, onError]);
117
122
  var actions = useMemo(function () {
118
123
  return username === assignee && isOpenTask(isOpen)
119
124
  ? (possibleActions || []).map(function (_a) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.2253",
3
+ "version": "1.4.2255",
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.2037",
14
+ "@reltio/mdm-sdk": "^1.4.2038",
15
15
  "@vis.gl/react-google-maps": "^1.3.0",
16
16
  "d3-cloud": "^1.2.5",
17
17
  "d3-geo": "^2.0.1",