@reltio/components 1.4.2226 → 1.4.2228

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 (83) hide show
  1. package/AttributeVerificationStatus/AttributeVerificationStatus.module.css.js +2 -2
  2. package/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.d.ts +9 -1
  3. package/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.js +3 -3
  4. package/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.module.css.js +1 -1
  5. package/SimpleAttribute/SimpleAttribute.d.ts +5 -2
  6. package/SimpleAttribute/SimpleAttribute.js +15 -7
  7. package/SimpleAttribute/SimpleAttribute.module.css.js +9 -0
  8. package/VerificationButton/VerificationButton.js +9 -17
  9. package/VerificationButton/VerificationButton.module.css.js +2 -2
  10. package/cjs/AttributeVerificationStatus/AttributeVerificationStatus.module.css.js +2 -2
  11. package/cjs/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.d.ts +9 -1
  12. package/cjs/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.js +3 -3
  13. package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.module.css.js +1 -1
  14. package/cjs/SimpleAttribute/SimpleAttribute.d.ts +5 -2
  15. package/cjs/SimpleAttribute/SimpleAttribute.js +19 -11
  16. package/cjs/SimpleAttribute/SimpleAttribute.module.css.js +9 -0
  17. package/cjs/VerificationButton/VerificationButton.js +9 -17
  18. package/cjs/VerificationButton/VerificationButton.module.css.js +2 -2
  19. package/cjs/features/crosswalks/AttributesTable/AttributesTable.js +3 -1
  20. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +4 -1
  21. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.js +51 -21
  22. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test.js +56 -0
  23. package/cjs/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.d.ts +7 -0
  24. package/cjs/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.js +31 -0
  25. package/cjs/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.module.css.js +9 -0
  26. package/cjs/features/crosswalks/AttributesTable/components/FallbackIndicator/index.d.ts +1 -0
  27. package/cjs/features/crosswalks/AttributesTable/components/FallbackIndicator/index.js +5 -0
  28. package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +3 -1
  29. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.js +1 -1
  30. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.d.ts +1 -1
  31. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.js +65 -11
  32. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.module.css.js +9 -0
  33. package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.d.ts +7 -0
  34. package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.js +15 -0
  35. package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightReporter.d.ts +7 -0
  36. package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightReporter.js +53 -0
  37. package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/index.d.ts +2 -0
  38. package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/index.js +7 -0
  39. package/cjs/features/crosswalks/AttributesTable/helpers.d.ts +4 -2
  40. package/cjs/features/crosswalks/AttributesTable/helpers.js +96 -17
  41. package/cjs/features/crosswalks/AttributesTable/helpers.test.js +499 -50
  42. package/cjs/features/crosswalks/AttributesTable/types.d.ts +17 -3
  43. package/cjs/features/crosswalks/contexts/SyncedValueHeightsContext.d.ts +11 -0
  44. package/cjs/features/crosswalks/contexts/SyncedValueHeightsContext.js +66 -0
  45. package/features/crosswalks/AttributesTable/AttributesTable.js +3 -1
  46. package/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +4 -1
  47. package/features/crosswalks/AttributesTable/AttributesTable.test-data.js +49 -20
  48. package/features/crosswalks/AttributesTable/AttributesTable.test.js +58 -2
  49. package/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.d.ts +7 -0
  50. package/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.js +24 -0
  51. package/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.module.css.js +9 -0
  52. package/features/crosswalks/AttributesTable/components/FallbackIndicator/index.d.ts +1 -0
  53. package/features/crosswalks/AttributesTable/components/FallbackIndicator/index.js +1 -0
  54. package/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +3 -1
  55. package/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.js +1 -1
  56. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.d.ts +1 -1
  57. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.js +65 -11
  58. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.module.css.js +9 -0
  59. package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.d.ts +7 -0
  60. package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.js +8 -0
  61. package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightReporter.d.ts +7 -0
  62. package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightReporter.js +23 -0
  63. package/features/crosswalks/AttributesTable/components/SyncedValueHeight/index.d.ts +2 -0
  64. package/features/crosswalks/AttributesTable/components/SyncedValueHeight/index.js +2 -0
  65. package/features/crosswalks/AttributesTable/helpers.d.ts +4 -2
  66. package/features/crosswalks/AttributesTable/helpers.js +95 -18
  67. package/features/crosswalks/AttributesTable/helpers.test.js +501 -52
  68. package/features/crosswalks/AttributesTable/types.d.ts +17 -3
  69. package/features/crosswalks/contexts/SyncedValueHeightsContext.d.ts +11 -0
  70. package/features/crosswalks/contexts/SyncedValueHeightsContext.js +38 -0
  71. package/package.json +2 -2
  72. package/SimpleAttribute/styles.d.ts +0 -1
  73. package/SimpleAttribute/styles.js +0 -42
  74. package/cjs/SimpleAttribute/styles.d.ts +0 -1
  75. package/cjs/SimpleAttribute/styles.js +0 -45
  76. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/styles.d.ts +0 -1
  77. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/styles.js +0 -13
  78. package/cjs/icons/VerifyAllIcon.d.ts +0 -3
  79. package/cjs/icons/VerifyAllIcon.js +0 -26
  80. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/styles.d.ts +0 -1
  81. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/styles.js +0 -10
  82. package/icons/VerifyAllIcon.d.ts +0 -3
  83. package/icons/VerifyAllIcon.js +0 -21
@@ -1,14 +1,28 @@
1
1
  import React from 'react';
2
- import { AttributeType, AttributeValue, Crosswalk, SurvivorStrategy } from '@reltio/mdm-sdk';
2
+ import { AttributeType, AttributeValue, Crosswalk, ParticipationStatus, SurvivorStrategy } from '@reltio/mdm-sdk';
3
3
  import { AddInlineAttributeEvent, DeleteInlineAttributeEvent, EditInlineAttributeEvent, IgnoreInlineAttributeEvent, PinInlineAttributeEvent } from '../../../types/inlineAttributes';
4
4
  import { ColumnData, RenderRowCellProps } from '../../../types/basicTable';
5
5
  import { CrosswalksMap } from '../../../types';
6
- export type RuleTypeValues = {
7
- ruleType: SurvivorStrategy;
6
+ export type StrategyAdditionalFields = {
8
7
  primaryAttributeUri?: string;
9
8
  comparisonAttributeUri?: string;
10
9
  sourcesUriOrder?: string[];
11
10
  };
11
+ export type AppliedSurvivorshipStrategy = {
12
+ strategy: SurvivorStrategy;
13
+ } & StrategyAdditionalFields;
14
+ export type RuleTypeItem = {
15
+ type: 'rule';
16
+ data: AppliedSurvivorshipStrategy;
17
+ valueUri: string;
18
+ } | {
19
+ type: 'status';
20
+ data: ParticipationStatus;
21
+ valueUri: string;
22
+ };
23
+ export type RuleTypeValues = {
24
+ ruleTypes: RuleTypeItem[];
25
+ };
12
26
  export type OvValues = {
13
27
  attributeType: AttributeType;
14
28
  values: AttributeValue[];
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ type Props = {
3
+ reportHeight: (uri: string, height: number) => void;
4
+ getHeight: (key: string) => number | undefined;
5
+ clear: () => void;
6
+ };
7
+ export declare const SyncedValueHeightsProvider: ({ children }: {
8
+ children: React.ReactNode;
9
+ }) => React.JSX.Element;
10
+ export declare const useSyncedValueHeights: () => Props;
11
+ export {};
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.useSyncedValueHeights = exports.SyncedValueHeightsProvider = void 0;
38
+ var react_1 = __importStar(require("react"));
39
+ var SyncedValueHeightsContext = (0, react_1.createContext)(null);
40
+ var SyncedValueHeightsProvider = function (_a) {
41
+ var children = _a.children;
42
+ var _b = (0, react_1.useState)({}), heights = _b[0], setHeights = _b[1];
43
+ var reportHeight = (0, react_1.useCallback)(function (uri, height) {
44
+ if (!uri || !height || heights[uri] === height)
45
+ return;
46
+ setHeights(function (prev) {
47
+ var _a;
48
+ return (__assign(__assign({}, prev), (_a = {}, _a[uri] = height, _a)));
49
+ });
50
+ }, [heights]);
51
+ var getHeight = (0, react_1.useCallback)(function (uri) { return (uri ? heights[uri] : 0); }, [heights]);
52
+ var clear = (0, react_1.useCallback)(function () {
53
+ setHeights({});
54
+ }, []);
55
+ var value = (0, react_1.useMemo)(function () { return ({ reportHeight: reportHeight, getHeight: getHeight, clear: clear }); }, [reportHeight, getHeight, clear]);
56
+ return react_1.default.createElement(SyncedValueHeightsContext.Provider, { value: value }, children);
57
+ };
58
+ exports.SyncedValueHeightsProvider = SyncedValueHeightsProvider;
59
+ var useSyncedValueHeights = function () {
60
+ var context = (0, react_1.useContext)(SyncedValueHeightsContext);
61
+ if (!context) {
62
+ throw new Error('useSyncedValueHeights must be used within SyncedValueHeightsProvider');
63
+ }
64
+ return context;
65
+ };
66
+ exports.useSyncedValueHeights = useSyncedValueHeights;
@@ -25,6 +25,7 @@ import { COLUMNS_DATA, DEFAULT_VISIBLE_COLUMNS, getBasicTableColumnsData, getBas
25
25
  import { ConfirmEditIgnoredDialog } from './components/ConfirmEditIgnoredDialog';
26
26
  import { CommonRowCellRenderer } from './components/CommonRowCellRenderer';
27
27
  import { LazyRenderer } from '../../../LazyRenderer';
28
+ import { SyncedValueHeightsProvider } from '../contexts/SyncedValueHeightsContext';
28
29
  import { useStyles } from './styles';
29
30
  var DEFAULT_ROW_HEIGHT = 68;
30
31
  var getIdFromRowValue = function (rowValue) { return rowValue.ovValues.attributeType.uri; };
@@ -119,7 +120,8 @@ var AttributesTable = function (_a) {
119
120
  React.createElement(ColumnsSettings, { columnsData: COLUMNS_DATA, selectedColumns: visibleColumns, onChangeColumns: onChangeVisibleColumns })),
120
121
  React.createElement("div", { className: styles.tableContent },
121
122
  isLoading && React.createElement(LinearLoadIndicator, null),
122
- React.createElement(BasicTable, { ref: tableRef, fixFirstColumn: true, headRowHeight: 48, defaultColumnWidth: 250, defaultColumnMinWidth: 200, columnsData: visibleColumnsData, dndRowReorderingEnabled: false, dndRowReorderingHandler: handleReorderAttributeTypes, getIdFromRowValue: getIdFromRowValue, rowsData: rowsData, onScroll: debouncedNotifyLazyRenderer, renderRowCell: renderRowCell, getRowCellHeight: getRowCellHeight, context: tableContext })),
123
+ React.createElement(SyncedValueHeightsProvider, null,
124
+ React.createElement(BasicTable, { ref: tableRef, fixFirstColumn: true, headRowHeight: 48, defaultColumnWidth: 250, defaultColumnMinWidth: 200, columnsData: visibleColumnsData, dndRowReorderingEnabled: false, dndRowReorderingHandler: handleReorderAttributeTypes, getIdFromRowValue: getIdFromRowValue, rowsData: rowsData, onScroll: debouncedNotifyLazyRenderer, renderRowCell: renderRowCell, getRowCellHeight: getRowCellHeight, context: tableContext }))),
123
125
  React.createElement(ConfirmDeleteDialog, { open: !!pendingDeletion, onClose: function () { return setPendingDeletion(null); }, onConfirm: handleDelete }),
124
126
  React.createElement(ConfirmEditIgnoredDialog, { open: !!pendingIgnoredEditing, onClose: function () { return setPendingIgnoredEditing(null); }, onConfirmEditWithIgnore: function () { return pendingIgnoredEditing && onEdit(pendingIgnoredEditing); }, onConfirmEditWithoutIgnore: function () {
125
127
  if (pendingIgnoredEditing)
@@ -1,5 +1,8 @@
1
1
  import { Entity, Metadata } from '@reltio/mdm-sdk';
2
- export declare const createEntity: () => Entity;
2
+ export declare const createEntity: ({ withAppliedSurvivorshipRules }?: {
3
+ withAppliedSurvivorshipRules?: boolean;
4
+ }) => Entity;
5
+ export declare const createEntityWithoutAppliedRule: () => Entity;
3
6
  export declare const createMetadata: () => Metadata;
4
7
  export declare const selectedAttributeTypes: ({
5
8
  description: string;
@@ -1,31 +1,45 @@
1
- export var createEntity = function () {
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 { ParticipationStatus } from '@reltio/mdm-sdk';
13
+ export var createEntity = function (_a) {
14
+ var _b = _a === void 0 ? {} : _a, _c = _b.withAppliedSurvivorshipRules, withAppliedSurvivorshipRules = _c === void 0 ? false : _c;
2
15
  return {
3
16
  uri: 'entities/01L2n5z',
4
17
  type: 'configuration/entityTypes/HCP',
5
18
  label: 'entity label',
6
19
  attributes: {
7
20
  Boolean: [
8
- {
9
- ov: true,
10
- type: 'configuration/entityTypes/HCP/attributes/Boolean',
11
- uri: 'entities/01L2n5z/attributes/Boolean/5nmc3Cp',
12
- value: 'true'
13
- }
21
+ __assign({ ov: true, type: 'configuration/entityTypes/HCP/attributes/Boolean', uri: 'entities/01L2n5z/attributes/Boolean/5nmc3Cp', value: 'true' }, (withAppliedSurvivorshipRules && {
22
+ ovDetails: {
23
+ participationStatus: ParticipationStatus.Strategy,
24
+ appliedSurvivorshipRules: 'Frequency'
25
+ }
26
+ }))
14
27
  ],
15
28
  TextField: [
16
- {
17
- ov: true,
18
- type: 'configuration/entityTypes/HCP/attributes/TextField',
19
- uri: 'entities/01L2n5z/attributes/TextField/5noU1aB',
20
- value: 'text field value'
21
- },
22
- {
23
- ov: false,
24
- type: 'configuration/entityTypes/HCP/attributes/TextField',
25
- uri: 'entities/01L2n5z/attributes/TextField/5noU1aB',
26
- value: 'another text value',
27
- ignored: true
28
- }
29
+ __assign({ ov: true, type: 'configuration/entityTypes/HCP/attributes/TextField', uri: 'entities/01L2n5z/attributes/TextField/5noU1aB', value: 'text field value' }, (withAppliedSurvivorshipRules && {
30
+ ovDetails: {
31
+ participationStatus: ParticipationStatus.Strategy,
32
+ appliedSurvivorshipRules: { SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'Aggregation'] }, 'Frequency'] }
33
+ }
34
+ })),
35
+ __assign({ ov: false, type: 'configuration/entityTypes/HCP/attributes/TextField', uri: 'entities/01L2n5z/attributes/TextField/5noU1aB', value: 'another text value', ignored: true }, (withAppliedSurvivorshipRules && {
36
+ ovDetails: {
37
+ participationStatus: ParticipationStatus.Strategy,
38
+ appliedSurvivorshipRules: {
39
+ SRC_SYS: [{ SRC_SYS: ['SRC_SYS', 'SRC_SYS'] }, { SRC_SYS: ['SRC_SYS'] }, 'LUD']
40
+ }
41
+ }
42
+ }))
29
43
  ],
30
44
  DeepNested: [
31
45
  {
@@ -103,6 +117,21 @@ export var createEntity = function () {
103
117
  ]
104
118
  };
105
119
  };
120
+ export var createEntityWithoutAppliedRule = function () {
121
+ var entity = createEntity({ withAppliedSurvivorshipRules: true });
122
+ return __assign(__assign({}, entity), { attributes: __assign(__assign({}, entity.attributes), { Boolean: [
123
+ {
124
+ ov: true,
125
+ type: 'configuration/entityTypes/HCP/attributes/Boolean',
126
+ uri: 'entities/01L2n5z/attributes/Boolean/5nmc3CpPinned',
127
+ value: 'false',
128
+ ovDetails: {
129
+ participationStatus: ParticipationStatus.Pinned,
130
+ appliedSurvivorshipRules: 'N/A'
131
+ }
132
+ }
133
+ ] }) });
134
+ };
106
135
  export var createMetadata = function () {
107
136
  return {
108
137
  entityTypes: [
@@ -60,9 +60,9 @@ import userEvent from '@testing-library/user-event';
60
60
  import { config } from 'react-transition-group';
61
61
  import { mockDndKit } from '../../../test-utils/dndKit';
62
62
  import { DndContext } from '@dnd-kit/core';
63
- import { mockBasicTableSizing } from '../../../test-utils';
63
+ import { getMuiIconByName, getMuiIconsByName, mockBasicTableSizing } from '../../../test-utils';
64
64
  import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
65
- import { createEntity, createMetadata, selectedAttributeTypes } from './AttributesTable.test-data';
65
+ import { createEntity, createEntityWithoutAppliedRule, createMetadata, selectedAttributeTypes } from './AttributesTable.test-data';
66
66
  import AttributesTable from './AttributesTable';
67
67
  jest.mock('@dnd-kit/core', function () { return mockDndKit; });
68
68
  jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { debounce: function (x) { return x; } })); });
@@ -446,6 +446,62 @@ describe('attribute table tests', function () {
446
446
  }
447
447
  });
448
448
  }); });
449
+ it('should render rule type column and fallback icons correctly according to applied survivorship rules', function () { return __awaiter(void 0, void 0, void 0, function () {
450
+ var unmockTableSizing, entity, user, ruleTypeColumns, ovValuesColumns, fallbackIcon, tooltip;
451
+ return __generator(this, function (_a) {
452
+ switch (_a.label) {
453
+ case 0:
454
+ unmockTableSizing = mockBasicTableSizing();
455
+ entity = createEntity({ withAppliedSurvivorshipRules: true });
456
+ user = setUp(__assign(__assign({}, defaultProps), { visibleColumns: undefined, entity: entity })).user;
457
+ expect(screen.getByText('Rule type')).toBeInTheDocument();
458
+ ruleTypeColumns = screen.getAllByTestId('column-name-ruleType');
459
+ expect(within(ruleTypeColumns[0]).getByText('Frequency')).toBeInTheDocument();
460
+ ovValuesColumns = screen.getAllByTestId('column-name-ovValues');
461
+ fallbackIcon = getMuiIconByName('Info', ovValuesColumns[0]);
462
+ return [4 /*yield*/, user.hover(fallbackIcon)];
463
+ case 1:
464
+ _a.sent();
465
+ return [4 /*yield*/, screen.findByRole('tooltip')];
466
+ case 2:
467
+ tooltip = _a.sent();
468
+ expect(within(tooltip).getByText('OV decision path')).toBeInTheDocument();
469
+ expect(within(tooltip).getAllByText('Source system').length).toBe(3);
470
+ expect(within(tooltip).getByText('Aggregation')).toBeInTheDocument();
471
+ expect(within(tooltip).getByText('Frequency')).toBeInTheDocument();
472
+ expect(getMuiIconsByName('CancelOutlined', tooltip).length).toBe(4);
473
+ expect(getMuiIconByName('CheckCircle', tooltip)).toBeInTheDocument();
474
+ expect(within(ruleTypeColumns[1]).getByText('Frequency')).toBeInTheDocument();
475
+ expect(getMuiIconByName('Info', ovValuesColumns[1])).not.toBeInTheDocument();
476
+ unmockTableSizing();
477
+ return [2 /*return*/];
478
+ }
479
+ });
480
+ }); });
481
+ it('should render N/A rule type and show tooltip in case of not participating value', function () { return __awaiter(void 0, void 0, void 0, function () {
482
+ var unmockTableSizing, entity, user, ruleTypeColumns, infoIcon, tooltip;
483
+ return __generator(this, function (_a) {
484
+ switch (_a.label) {
485
+ case 0:
486
+ unmockTableSizing = mockBasicTableSizing();
487
+ entity = createEntityWithoutAppliedRule();
488
+ user = setUp(__assign(__assign({}, defaultProps), { visibleColumns: undefined, entity: entity })).user;
489
+ ruleTypeColumns = screen.getAllByTestId('column-name-ruleType');
490
+ expect(within(ruleTypeColumns[1]).getByText('N/A')).toBeInTheDocument();
491
+ infoIcon = getMuiIconByName('Info', ruleTypeColumns[1]);
492
+ expect(infoIcon).toBeInTheDocument();
493
+ return [4 /*yield*/, user.hover(infoIcon)];
494
+ case 1:
495
+ _a.sent();
496
+ return [4 /*yield*/, screen.findByRole('tooltip')];
497
+ case 2:
498
+ tooltip = _a.sent();
499
+ expect(within(tooltip).getByText("Value survives because 'pin' flag is set. Survivorship not evaluated")).toBeInTheDocument();
500
+ unmockTableSizing();
501
+ return [2 /*return*/];
502
+ }
503
+ });
504
+ }); });
449
505
  describe('Edit attributes', function () {
450
506
  it('should edit attributes', function () { return __awaiter(void 0, void 0, void 0, function () {
451
507
  var unmockTableSizing, entity, onEdit, props, user;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { OvDetails } from '@reltio/mdm-sdk';
3
+ type Props = {
4
+ ovDetails: OvDetails;
5
+ };
6
+ export declare const FallbackIndicator: ({ ovDetails }: Props) => React.JSX.Element;
7
+ export {};
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import i18n from 'ui-i18n';
3
+ import Typography from '@mui/material/Typography';
4
+ import CheckCircleIcon from '@mui/icons-material/CheckCircle';
5
+ import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined';
6
+ import InfoIcon from '@mui/icons-material/Info';
7
+ import { useMdmMetadata } from '../../../../../contexts/MdmModuleContext';
8
+ import { getFallbackLabels } from '../../helpers';
9
+ import { withTooltip } from '../../../../../HOCs/withTooltip';
10
+ import styles from './FallbackIndicator.module.css';
11
+ var InfoIconWithTooltip = withTooltip(InfoIcon);
12
+ export var FallbackIndicator = function (_a) {
13
+ var ovDetails = _a.ovDetails;
14
+ var metadata = useMdmMetadata();
15
+ var fallbackLabels = getFallbackLabels(metadata, ovDetails);
16
+ var renderTooltip = function () {
17
+ return (React.createElement("div", { className: styles.fallbackList },
18
+ React.createElement(Typography, { variant: "caption", className: styles.fallbackTitle }, i18n.text('OV decision path')),
19
+ fallbackLabels.map(function (label, index) { return (React.createElement("div", { key: index, className: styles.fallbackItem },
20
+ index === fallbackLabels.length - 1 ? (React.createElement(CheckCircleIcon, { className: styles.fallbackItemIcon })) : (React.createElement(CancelOutlinedIcon, { className: styles.fallbackItemIcon })),
21
+ React.createElement(Typography, { variant: "caption" }, label))); })));
22
+ };
23
+ return fallbackLabels.length > 0 ? (React.createElement(InfoIconWithTooltip, { tooltipTitle: renderTooltip(), className: styles.fallbackIcon })) : null;
24
+ };
@@ -0,0 +1,9 @@
1
+ const styles = {"fallbackItem":"FallbackIndicator-fallbackItem--6CBy-","fallbackItemIcon":"FallbackIndicator-fallbackItemIcon--8HsII","fallbackList":"FallbackIndicator-fallbackList--3JCCL","fallbackTitle":"FallbackIndicator-fallbackTitle--abWeO","fallbackIcon":"FallbackIndicator-fallbackIcon--ox4Ec"};
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 = `.FallbackIndicator-fallbackItem--6CBy-{align-items:center;color:hsla(0,0%,100%,.6);display:flex;font-size:13px;padding-top:8px;position:relative}.FallbackIndicator-fallbackItem--6CBy-:last-child{color:#fff}.FallbackIndicator-fallbackItem--6CBy-:not(:last-child):after{background:hsla(0,0%,100%,.6);content:"";height:8px;left:7px;position:absolute;top:28px;width:2px}.FallbackIndicator-fallbackItemIcon--8HsII{height:16px;margin-right:4px;width:16px}.FallbackIndicator-fallbackList--3JCCL{min-width:150px;padding-bottom:8px;padding-top:8px}.FallbackIndicator-fallbackTitle--abWeO{font-weight:500;padding-bottom:4px}.FallbackIndicator-fallbackIcon--ox4Ec{color:var(--mui-palette-text-secondary);height:16px;margin-left:4px;vertical-align:middle;width:16px}`;
7
+ head.appendChild(style);
8
+ }
9
+ export default styles;
@@ -0,0 +1 @@
1
+ export { FallbackIndicator } from './FallbackIndicator';
@@ -0,0 +1 @@
1
+ export { FallbackIndicator } from './FallbackIndicator';
@@ -16,7 +16,9 @@ import { ReadOnlyAttributeValuesBlock } from '../../../../../ReadOnlyAttributeVa
16
16
  import { AttributeTitle } from '../../../../../AttributeTitle';
17
17
  import { EntityContext } from '../../../../../contexts/EntityContext';
18
18
  import { useMdmEntity } from '../../../../../contexts/MdmModuleContext';
19
+ import { FallbackIndicator } from '../FallbackIndicator';
19
20
  import { useCommonStyles } from '../../styles';
21
+ import { ValueHeightReporter } from '../SyncedValueHeight';
20
22
  import { useStyles } from './styles';
21
23
  export var OvValuesRenderer = function (_a) {
22
24
  var _b = _a.value, values = _b.values, attributeType = _b.attributeType, someRowIsDragging = _a.someRowIsDragging, draggableProps = _a.draggableProps;
@@ -28,5 +30,5 @@ export var OvValuesRenderer = function (_a) {
28
30
  React.createElement(DragIndicatorIcon, { className: styles.dragIndicatorIcon })),
29
31
  React.createElement(AttributeTitle, { className: styles.attributeTitle, label: attributeType.label }),
30
32
  !someRowIsDragging && (React.createElement(EntityContext.Provider, { value: entity },
31
- React.createElement(ReadOnlyAttributeValuesBlock, { values: values, attributeType: attributeType, valueContainerClassName: styles.ovValue })))));
33
+ React.createElement(ReadOnlyAttributeValuesBlock, { values: values, attributeType: attributeType, valueContainerClassName: styles.ovValue, AttributeValueWrapper: ValueHeightReporter, FallbackSlot: FallbackIndicator })))));
32
34
  };
@@ -64,7 +64,7 @@ export var RuleTypeInfoButton = function (_a) {
64
64
  var openPopup = function (event) { return setAnchorEl(event.currentTarget); };
65
65
  var closePopup = function () { return setAnchorEl(null); };
66
66
  return (React.createElement(React.Fragment, null,
67
- React.createElement(SmallIconButtonWithTooltip, { icon: InfoIcon, tooltipTitle: i18n.text('View details'), size: 'XS', onClick: openPopup }),
67
+ React.createElement(SmallIconButtonWithTooltip, { icon: InfoIcon, tooltipTitle: i18n.text('View details'), size: 'XXS', onClick: openPopup }),
68
68
  React.createElement(Popover, { classes: { paper: styles.rulePopup }, open: !!anchorEl, anchorEl: anchorEl, onClose: closePopup, anchorOrigin: {
69
69
  vertical: 'bottom',
70
70
  horizontal: 'right'
@@ -3,5 +3,5 @@ import { RuleTypeValues } from '../../types';
3
3
  type Props = {
4
4
  value: RuleTypeValues;
5
5
  };
6
- export declare const RuleTypeRenderer: ({ value: { ruleType, sourcesUriOrder, primaryAttributeUri, comparisonAttributeUri } }: Props) => React.JSX.Element;
6
+ export declare const RuleTypeRenderer: ({ value: { ruleTypes } }: Props) => React.JSX.Element;
7
7
  export {};
@@ -1,18 +1,72 @@
1
+ var _a;
1
2
  import React from 'react';
3
+ import i18n from 'ui-i18n';
2
4
  import classnames from 'classnames';
5
+ import InfoIcon from '@mui/icons-material/Info';
6
+ import { ParticipationStatus } from '@reltio/mdm-sdk';
7
+ import { withTooltip } from '../../../../../HOCs/withTooltip';
3
8
  import { RuleTypeInfoButton } from '../RuleTypeInfoButton';
4
9
  import { useCommonStyles } from '../../styles';
5
- import { useStyles } from './styles';
10
+ import { ValueHeightConsumer } from '../SyncedValueHeight';
11
+ import styles from './RuleTypeRenderer.module.css';
12
+ var InfoIconWithTooltip = withTooltip(InfoIcon);
13
+ var PARTICIPATION_STATUS_MAP = (_a = {},
14
+ Object.defineProperty(_a, ParticipationStatus.Pinned, {
15
+ get: function () {
16
+ return i18n.text("Value survives because 'pin' flag is set. Survivorship not evaluated");
17
+ },
18
+ enumerable: false,
19
+ configurable: true
20
+ }),
21
+ Object.defineProperty(_a, ParticipationStatus.Ignored, {
22
+ get: function () {
23
+ return i18n.text("Value did not participate in survivorship evaluation because 'ignore' flag is set");
24
+ },
25
+ enumerable: false,
26
+ configurable: true
27
+ }),
28
+ Object.defineProperty(_a, ParticipationStatus.EndDatedCrosswalk, {
29
+ get: function () {
30
+ return i18n.text("Value did not participate in survivorship evaluation because it's crosswalk is end-dated");
31
+ },
32
+ enumerable: false,
33
+ configurable: true
34
+ }),
35
+ Object.defineProperty(_a, ParticipationStatus.NotParticipating, {
36
+ get: function () {
37
+ return i18n.text('Value did not participate in survivorship evaluation because another value was pinned or the source was ignored');
38
+ },
39
+ enumerable: false,
40
+ configurable: true
41
+ }),
42
+ _a);
6
43
  export var RuleTypeRenderer = function (_a) {
7
- var _b = _a.value, ruleType = _b.ruleType, sourcesUriOrder = _b.sourcesUriOrder, primaryAttributeUri = _b.primaryAttributeUri, comparisonAttributeUri = _b.comparisonAttributeUri;
8
- var styles = useStyles();
44
+ var ruleTypes = _a.value.ruleTypes;
9
45
  var commonStyles = useCommonStyles();
10
- var showInfoIcon = sourcesUriOrder || primaryAttributeUri || comparisonAttributeUri;
11
- return (React.createElement("div", { className: classnames(styles.root, commonStyles.basicCell) },
12
- React.createElement("div", { className: styles.label }, ruleType.label),
13
- showInfoIcon && (React.createElement(RuleTypeInfoButton, { info: {
14
- sourcesUriOrder: sourcesUriOrder,
15
- primaryAttributeUri: primaryAttributeUri,
16
- comparisonAttributeUri: comparisonAttributeUri
17
- } }))));
46
+ var renderStrategy = function (data) {
47
+ var strategy = data.strategy, primaryAttributeUri = data.primaryAttributeUri, comparisonAttributeUri = data.comparisonAttributeUri, sourcesUriOrder = data.sourcesUriOrder;
48
+ if (!strategy)
49
+ return null;
50
+ var showInfoIcon = sourcesUriOrder || primaryAttributeUri || comparisonAttributeUri;
51
+ return (React.createElement("div", { className: styles.strategyItem },
52
+ React.createElement("div", { className: styles.label }, strategy.label),
53
+ showInfoIcon && (React.createElement(RuleTypeInfoButton, { info: {
54
+ sourcesUriOrder: sourcesUriOrder,
55
+ primaryAttributeUri: primaryAttributeUri,
56
+ comparisonAttributeUri: comparisonAttributeUri
57
+ } }))));
58
+ };
59
+ var renderStatus = function (participationStatus) {
60
+ var description = PARTICIPATION_STATUS_MAP[participationStatus];
61
+ return (React.createElement("div", { className: styles.statusItem },
62
+ i18n.text('N/A'),
63
+ description && React.createElement(InfoIconWithTooltip, { className: styles.infoIcon, tooltipTitle: description })));
64
+ };
65
+ var renderRuleType = function (item) {
66
+ if (item.type === 'status') {
67
+ return renderStatus(item.data);
68
+ }
69
+ return renderStrategy(item.data);
70
+ };
71
+ return (React.createElement("div", { className: classnames(styles.list, commonStyles.basicCell) }, ruleTypes.map(function (item) { return (React.createElement(ValueHeightConsumer, { key: item.valueUri, uri: item.valueUri }, renderRuleType(item))); })));
18
72
  };
@@ -0,0 +1,9 @@
1
+ const styles = {"list":"RuleTypeRenderer-list--IejtI","label":"RuleTypeRenderer-label--9oONL","strategyItem":"RuleTypeRenderer-strategyItem--yfhkv","statusItem":"RuleTypeRenderer-statusItem--R23Qz","infoIcon":"RuleTypeRenderer-infoIcon--LVMk6"};
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 = `.RuleTypeRenderer-list--IejtI:before{content:"";display:block;height:20px}.RuleTypeRenderer-list--IejtI>div+div{margin-top:4px}.RuleTypeRenderer-label--9oONL{margin-right:5px}.RuleTypeRenderer-statusItem--R23Qz,.RuleTypeRenderer-strategyItem--yfhkv{align-items:center;display:flex}.RuleTypeRenderer-infoIcon--LVMk6{color:var(--mui-palette-text-secondary);height:16px;margin-left:4px;width:16px}`;
7
+ head.appendChild(style);
8
+ }
9
+ export default styles;
@@ -0,0 +1,7 @@
1
+ import React, { ReactNode } from 'react';
2
+ type Props = {
3
+ uri: string;
4
+ children: ReactNode;
5
+ };
6
+ export declare const ValueHeightConsumer: ({ uri, children }: Props) => React.JSX.Element;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { useSyncedValueHeights } from '../../../contexts/SyncedValueHeightsContext';
3
+ export var ValueHeightConsumer = function (_a) {
4
+ var uri = _a.uri, children = _a.children;
5
+ var getHeight = useSyncedValueHeights().getHeight;
6
+ var height = getHeight(uri);
7
+ return React.createElement("div", { style: height ? { minHeight: height } : undefined }, children);
8
+ };
@@ -0,0 +1,7 @@
1
+ import React, { ReactNode } from 'react';
2
+ type Props = {
3
+ uri: string;
4
+ children: ReactNode;
5
+ };
6
+ export declare const ValueHeightReporter: ({ uri, children }: Props) => React.JSX.Element;
7
+ export {};
@@ -0,0 +1,23 @@
1
+ import React, { useCallback, useLayoutEffect, useRef } from 'react';
2
+ import ReactResizeDetector from 'react-resize-detector';
3
+ import { useSyncedValueHeights } from '../../../contexts/SyncedValueHeightsContext';
4
+ export var ValueHeightReporter = function (_a) {
5
+ var uri = _a.uri, children = _a.children;
6
+ var reportHeight = useSyncedValueHeights().reportHeight;
7
+ var contentRef = useRef(null);
8
+ var lastHeightRef = useRef();
9
+ var report = useCallback(function () {
10
+ var _a;
11
+ var height = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight;
12
+ if (!height || height === lastHeightRef.current)
13
+ return;
14
+ lastHeightRef.current = height;
15
+ reportHeight(uri, height);
16
+ }, [reportHeight, uri, lastHeightRef]);
17
+ useLayoutEffect(function () {
18
+ report();
19
+ }, [report]);
20
+ return (React.createElement("div", { ref: contentRef },
21
+ React.createElement(ReactResizeDetector, { handleHeight: true, onResize: report }),
22
+ children));
23
+ };
@@ -0,0 +1,2 @@
1
+ export { ValueHeightConsumer } from './ValueHeightConsumer';
2
+ export { ValueHeightReporter } from './ValueHeightReporter';
@@ -0,0 +1,2 @@
1
+ export { ValueHeightConsumer } from './ValueHeightConsumer';
2
+ export { ValueHeightReporter } from './ValueHeightReporter';
@@ -1,4 +1,4 @@
1
- import { AttributeType, AttributeValue, Crosswalk, Metadata, RecordAttributesType } from '@reltio/mdm-sdk';
1
+ import { AppliedSurvivorshipRule, AttributeType, AttributeValue, Crosswalk, Metadata, OvDetails, RecordAttributesType } from '@reltio/mdm-sdk';
2
2
  import { CrosswalksMap } from '../../../types';
3
3
  import { CrosswalksByOwnerTypeMap } from '../types';
4
4
  import { AttributesTableRowValue, RuleTypeValues } from './types';
@@ -29,7 +29,9 @@ export declare const COLUMNS_DATA: ({
29
29
  })[];
30
30
  export declare const DEFAULT_VISIBLE_COLUMNS: string[];
31
31
  export declare const countAttributeValues: (type: string, values: AttributeValue[], crosswalksMap: CrosswalksMap) => number;
32
- export declare const getRuleTypeValues: (metadata: Metadata, attributeType: AttributeType, parentTypeUri: string, activeSurvivorshipGroupUri?: string) => RuleTypeValues;
32
+ export declare const collectRuleNames: (rule: AppliedSurvivorshipRule | undefined) => string[];
33
+ export declare const getFallbackLabels: (metadata: Metadata, ovDetails: OvDetails) => string[];
34
+ export declare const getRuleTypeValues: (metadata: Metadata, attributeType: AttributeType, parentTypeUri: string, attributeValues: AttributeValue[], activeSurvivorshipGroupUri?: string) => RuleTypeValues;
33
35
  export declare const getWinnerCrosswalks: (attributeValues: AttributeValue[], crosswalksMap: CrosswalksMap) => Crosswalk[];
34
36
  export declare const getBasicTableColumnsData: any;
35
37
  export declare const getBasicTableRowsData: (metadata: Metadata, parentTypeUri: string, attrTypes: AttributeType[], columns: string[], crosswalksMap: CrosswalksByOwnerTypeMap, attributes: RecordAttributesType, activeSurvivorshipGroupUri?: string) => AttributesTableRowValue[];