@reltio/components 1.4.2230 → 1.4.2232

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 (126) hide show
  1. package/HierarchyNodeTitle/HierarchyNodeTitle.d.ts +2 -1
  2. package/HierarchyNodeTitle/HierarchyNodeTitle.js +2 -2
  3. package/InlineComplexAttribute/InlineComplexAttribute.js +2 -2
  4. package/InlineComplexAttribute/InlineComplexAttribute.test.js +7 -7
  5. package/ProfileCard/components/ProfileCardContent/styles.d.ts +1 -1
  6. package/ReadOnlyAttributesList/ReadOnlyAttributesList.d.ts +5 -2
  7. package/ReadOnlyAttributesList/ReadOnlyAttributesList.js +2 -2
  8. package/ReadOnlyAttributesPager/ReadOnlyAttributesPager.d.ts +5 -2
  9. package/ReadOnlyAttributesPager/ReadOnlyAttributesPager.js +3 -3
  10. package/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.d.ts +5 -2
  11. package/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.js +15 -11
  12. package/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.d.ts +5 -2
  13. package/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.js +13 -11
  14. package/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.d.ts +5 -2
  15. package/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.js +24 -12
  16. package/SimpleAttribute/SimpleAttribute.js +3 -2
  17. package/SyncedValueHeight/ValueHeightConsumer.js +12 -0
  18. package/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightReporter.js +12 -6
  19. package/cjs/HierarchyNodeTitle/HierarchyNodeTitle.d.ts +2 -1
  20. package/cjs/HierarchyNodeTitle/HierarchyNodeTitle.js +2 -2
  21. package/cjs/InlineComplexAttribute/InlineComplexAttribute.js +2 -2
  22. package/cjs/InlineComplexAttribute/InlineComplexAttribute.test.js +7 -7
  23. package/cjs/ProfileCard/components/ProfileCardContent/styles.d.ts +1 -1
  24. package/cjs/ReadOnlyAttributesList/ReadOnlyAttributesList.d.ts +5 -2
  25. package/cjs/ReadOnlyAttributesList/ReadOnlyAttributesList.js +2 -2
  26. package/cjs/ReadOnlyAttributesPager/ReadOnlyAttributesPager.d.ts +5 -2
  27. package/cjs/ReadOnlyAttributesPager/ReadOnlyAttributesPager.js +3 -3
  28. package/cjs/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.d.ts +5 -2
  29. package/cjs/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.js +15 -11
  30. package/cjs/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.d.ts +5 -2
  31. package/cjs/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.js +13 -11
  32. package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.d.ts +5 -2
  33. package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.js +23 -11
  34. package/cjs/SimpleAttribute/SimpleAttribute.js +3 -2
  35. package/cjs/SyncedValueHeight/ValueHeightConsumer.js +39 -0
  36. package/cjs/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightReporter.js +11 -5
  37. package/cjs/contexts/AutoExpandedAttributesContext/index.d.ts +8 -0
  38. package/cjs/contexts/{ExpandedAttributesContext → AutoExpandedAttributesContext}/index.js +8 -8
  39. package/cjs/contexts/{ExpandedAttributesContext/useAttributeExpanded.test.js → AutoExpandedAttributesContext/useAttributeAutoExpanded.test.js} +3 -3
  40. package/cjs/contexts/SyncedExpandedAttributesContext/index.d.ts +12 -0
  41. package/cjs/contexts/SyncedExpandedAttributesContext/index.js +56 -0
  42. package/{features/crosswalks/contexts/SyncedValueHeightsContext.d.ts → cjs/contexts/SyncedValueHeightsContext/index.d.ts} +2 -2
  43. package/cjs/{features/crosswalks/contexts/SyncedValueHeightsContext.js → contexts/SyncedValueHeightsContext/index.js} +10 -15
  44. package/cjs/features/crosswalks/AttributesTable/AttributesTable.js +5 -3
  45. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +1 -1
  46. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.js +93 -34
  47. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test.js +290 -56
  48. package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.d.ts +11 -0
  49. package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.js +32 -0
  50. package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.module.css.js +9 -0
  51. package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/index.d.ts +1 -0
  52. package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/index.js +5 -0
  53. package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.d.ts +10 -0
  54. package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.js +60 -0
  55. package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.module.css.js +9 -0
  56. package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/index.d.ts +1 -0
  57. package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/index.js +5 -0
  58. package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +1 -1
  59. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.d.ts +1 -1
  60. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.js +5 -64
  61. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.module.css.js +2 -2
  62. package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.d.ts +10 -0
  63. package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.js +94 -0
  64. package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.module.css.js +9 -0
  65. package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/index.d.ts +1 -0
  66. package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/index.js +5 -0
  67. package/cjs/features/crosswalks/AttributesTable/helpers.d.ts +1 -2
  68. package/cjs/features/crosswalks/AttributesTable/helpers.js +82 -56
  69. package/cjs/features/crosswalks/AttributesTable/helpers.test.js +539 -360
  70. package/cjs/features/crosswalks/AttributesTable/types.d.ts +17 -10
  71. package/cjs/features/crosswalks/AttributesTable/types.js +6 -0
  72. package/cjs/index.d.ts +1 -1
  73. package/cjs/index.js +4 -4
  74. package/contexts/AutoExpandedAttributesContext/index.d.ts +8 -0
  75. package/contexts/AutoExpandedAttributesContext/index.js +11 -0
  76. package/contexts/{ExpandedAttributesContext/useAttributeExpanded.test.js → AutoExpandedAttributesContext/useAttributeAutoExpanded.test.js} +4 -4
  77. package/contexts/SyncedExpandedAttributesContext/index.d.ts +12 -0
  78. package/contexts/SyncedExpandedAttributesContext/index.js +28 -0
  79. package/{cjs/features/crosswalks/contexts/SyncedValueHeightsContext.d.ts → contexts/SyncedValueHeightsContext/index.d.ts} +2 -2
  80. package/{features/crosswalks/contexts/SyncedValueHeightsContext.js → contexts/SyncedValueHeightsContext/index.js} +9 -13
  81. package/features/crosswalks/AttributesTable/AttributesTable.js +5 -3
  82. package/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +1 -1
  83. package/features/crosswalks/AttributesTable/AttributesTable.test-data.js +91 -32
  84. package/features/crosswalks/AttributesTable/AttributesTable.test.js +291 -57
  85. package/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.d.ts +11 -0
  86. package/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.js +25 -0
  87. package/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.module.css.js +9 -0
  88. package/features/crosswalks/AttributesTable/components/AttributeRule/index.d.ts +1 -0
  89. package/features/crosswalks/AttributesTable/components/AttributeRule/index.js +1 -0
  90. package/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.d.ts +10 -0
  91. package/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.js +30 -0
  92. package/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.module.css.js +9 -0
  93. package/features/crosswalks/AttributesTable/components/ComplexRule/index.d.ts +1 -0
  94. package/features/crosswalks/AttributesTable/components/ComplexRule/index.js +1 -0
  95. package/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +1 -1
  96. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.d.ts +1 -1
  97. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.js +6 -65
  98. package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.module.css.js +2 -2
  99. package/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.d.ts +10 -0
  100. package/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.js +64 -0
  101. package/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.module.css.js +9 -0
  102. package/features/crosswalks/AttributesTable/components/SimpleRule/index.d.ts +1 -0
  103. package/features/crosswalks/AttributesTable/components/SimpleRule/index.js +1 -0
  104. package/features/crosswalks/AttributesTable/helpers.d.ts +1 -2
  105. package/features/crosswalks/AttributesTable/helpers.js +82 -55
  106. package/features/crosswalks/AttributesTable/helpers.test.js +540 -361
  107. package/features/crosswalks/AttributesTable/types.d.ts +17 -10
  108. package/features/crosswalks/AttributesTable/types.js +5 -1
  109. package/index.d.ts +1 -1
  110. package/index.js +1 -1
  111. package/package.json +2 -2
  112. package/cjs/contexts/ExpandedAttributesContext/index.d.ts +0 -8
  113. package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.js +0 -15
  114. package/contexts/ExpandedAttributesContext/index.d.ts +0 -8
  115. package/contexts/ExpandedAttributesContext/index.js +0 -11
  116. package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.js +0 -8
  117. /package/{cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightConsumer.d.ts +0 -0
  118. /package/{cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightReporter.d.ts +0 -0
  119. /package/{cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/index.d.ts +0 -0
  120. /package/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/index.js +0 -0
  121. /package/{features/crosswalks/AttributesTable/components → cjs}/SyncedValueHeight/ValueHeightConsumer.d.ts +0 -0
  122. /package/{features/crosswalks/AttributesTable/components → cjs}/SyncedValueHeight/ValueHeightReporter.d.ts +0 -0
  123. /package/{features/crosswalks/AttributesTable/components → cjs}/SyncedValueHeight/index.d.ts +0 -0
  124. /package/cjs/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/index.js +0 -0
  125. /package/cjs/contexts/{ExpandedAttributesContext/useAttributeExpanded.test.d.ts → AutoExpandedAttributesContext/useAttributeAutoExpanded.test.d.ts} +0 -0
  126. /package/contexts/{ExpandedAttributesContext/useAttributeExpanded.test.d.ts → AutoExpandedAttributesContext/useAttributeAutoExpanded.test.d.ts} +0 -0
@@ -0,0 +1,64 @@
1
+ var _a;
2
+ import React, { useCallback } from 'react';
3
+ import i18n from 'ui-i18n';
4
+ import InfoIcon from '@mui/icons-material/Info';
5
+ import { ParticipationStatus } from '@reltio/mdm-sdk';
6
+ import { withTooltip } from '../../../../../HOCs/withTooltip';
7
+ import { RuleItemType } from '../../types';
8
+ import { RuleTypeInfoButton } from '../RuleTypeInfoButton';
9
+ import styles from './SimpleRule.module.css';
10
+ var InfoIconWithTooltip = withTooltip(InfoIcon);
11
+ var PARTICIPATION_STATUS_MAP = (_a = {},
12
+ Object.defineProperty(_a, ParticipationStatus.Pinned, {
13
+ get: function () {
14
+ return i18n.text("Value survives because 'pin' flag is set. Survivorship not evaluated");
15
+ },
16
+ enumerable: false,
17
+ configurable: true
18
+ }),
19
+ Object.defineProperty(_a, ParticipationStatus.Ignored, {
20
+ get: function () {
21
+ return i18n.text("Value did not participate in survivorship evaluation because 'ignore' flag is set");
22
+ },
23
+ enumerable: false,
24
+ configurable: true
25
+ }),
26
+ Object.defineProperty(_a, ParticipationStatus.EndDatedCrosswalk, {
27
+ get: function () {
28
+ return i18n.text('Value did not participate in survivorship evaluation because its crosswalk is end-dated');
29
+ },
30
+ enumerable: false,
31
+ configurable: true
32
+ }),
33
+ Object.defineProperty(_a, ParticipationStatus.NotParticipating, {
34
+ get: function () {
35
+ return i18n.text('Value did not participate in survivorship evaluation because another value was pinned or the source was ignored');
36
+ },
37
+ enumerable: false,
38
+ configurable: true
39
+ }),
40
+ _a);
41
+ export var SimpleRule = function (_a) {
42
+ var attributeType = _a.attributeType, attributeValue = _a.attributeValue, getRuleTypeData = _a.getRuleTypeData;
43
+ var renderStrategy = useCallback(function (data) {
44
+ var strategy = data.strategy, primaryAttributeUri = data.primaryAttributeUri, comparisonAttributeUri = data.comparisonAttributeUri, sourcesUriOrder = data.sourcesUriOrder;
45
+ if (!strategy)
46
+ return null;
47
+ var showInfoIcon = sourcesUriOrder || primaryAttributeUri || comparisonAttributeUri;
48
+ return (React.createElement("div", { className: styles.strategyItem },
49
+ React.createElement("div", { className: styles.label }, strategy.label),
50
+ showInfoIcon && (React.createElement(RuleTypeInfoButton, { info: {
51
+ sourcesUriOrder: sourcesUriOrder,
52
+ primaryAttributeUri: primaryAttributeUri,
53
+ comparisonAttributeUri: comparisonAttributeUri
54
+ } }))));
55
+ }, []);
56
+ var renderStatus = useCallback(function (participationStatus) {
57
+ var description = PARTICIPATION_STATUS_MAP[participationStatus];
58
+ return (React.createElement("div", { className: styles.statusItem },
59
+ i18n.text('N/A'),
60
+ description && React.createElement(InfoIconWithTooltip, { className: styles.infoIcon, tooltipTitle: description })));
61
+ }, []);
62
+ var _b = getRuleTypeData(attributeType, attributeValue), type = _b.type, data = _b.data;
63
+ return type === RuleItemType.Status ? renderStatus(data) : renderStrategy(data);
64
+ };
@@ -0,0 +1,9 @@
1
+ const styles = {"label":"SimpleRule-label--UMv66","strategyItem":"SimpleRule-strategyItem--3WO1E","statusItem":"SimpleRule-statusItem--tkZgO","infoIcon":"SimpleRule-infoIcon--zFQFu"};
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 = `.SimpleRule-label--UMv66{margin-right:5px;white-space:nowrap}.SimpleRule-statusItem--tkZgO,.SimpleRule-strategyItem--3WO1E{align-items:center;display:flex}.SimpleRule-infoIcon--zFQFu{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 @@
1
+ export { SimpleRule } from './SimpleRule';
@@ -0,0 +1 @@
1
+ export { SimpleRule } from './SimpleRule';
@@ -1,7 +1,7 @@
1
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
- import { AttributesTableRowValue, RuleTypeValues } from './types';
4
+ import { AttributesTableRowValue } from './types';
5
5
  export declare const COLUMNS_DATA: ({
6
6
  id: string;
7
7
  readonly label: string;
@@ -31,7 +31,6 @@ export declare const DEFAULT_VISIBLE_COLUMNS: string[];
31
31
  export declare const countAttributeValues: (type: string, values: AttributeValue[], crosswalksMap: CrosswalksMap) => number;
32
32
  export declare const collectRuleNames: (rule: AppliedSurvivorshipRule | undefined) => string[];
33
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;
35
34
  export declare const getWinnerCrosswalks: (attributeValues: AttributeValue[], crosswalksMap: CrosswalksMap) => Crosswalk[];
36
35
  export declare const getBasicTableColumnsData: any;
37
36
  export declare const getBasicTableRowsData: (metadata: Metadata, parentTypeUri: string, attrTypes: AttributeType[], columns: string[], crosswalksMap: CrosswalksByOwnerTypeMap, attributes: RecordAttributesType, activeSurvivorshipGroupUri?: string) => AttributesTableRowValue[];
@@ -1,14 +1,3 @@
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
1
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
2
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
3
  if (ar || !(i in from)) {
@@ -19,7 +8,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
8
  return to.concat(ar || Array.prototype.slice.call(from));
20
9
  };
21
10
  import i18n from 'ui-i18n';
22
- import { assoc, chain, curry, descend, filter, find, flatten, isNil, last, map, pathOr, pickBy, pipe, prop, propEq, propOr, reduce, reject, sortWith, uniq, uniqBy, values } from 'ramda';
11
+ import { assoc, chain, curry, descend, filter, find, flatten, has, last, map, pathOr, pick, pickBy, pipe, prop, propEq, propOr, reduce, sortWith, uniq, uniqBy, values } from 'ramda';
23
12
  import { areOneHierarchyUris, DataTypes, findValueInAttributesByUriSuffix, getBaseUri, getCrosswalksTypes, getDefaultSurvivorshipStrategy, getLastUriPart, getReferencedAttrTypeUrisFromAttrType, getSurvivorshipStrategy, isComplexAttribute, isOv, isReference, isTempUri, ParticipationStatus } from '@reltio/mdm-sdk';
24
13
  import { HeadCellRenderer } from './components/HeadCellRenderer';
25
14
  import { AttributesHeadCellRenderer } from './components/AttributesHeadCellRenderer';
@@ -29,6 +18,7 @@ import { OvValuesRenderer } from './components/OvValuesRenderer';
29
18
  import { CountRenderer } from './components/CountRenderer';
30
19
  import { RuleTypeRenderer } from './components/RuleTypeRenderer';
31
20
  import { WinnerSourcesRenderer } from './components/WinnerSourcesRenderer';
21
+ import { RuleItemType } from './types';
32
22
  export var COLUMNS_DATA = [
33
23
  {
34
24
  id: 'ovValues',
@@ -142,7 +132,8 @@ export var getFallbackLabels = function (metadata, ovDetails) {
142
132
  }
143
133
  return rules.map(function (uri) { var _a; return ((_a = getSurvivorshipStrategy(metadata, uri)) === null || _a === void 0 ? void 0 : _a.label) || uri; });
144
134
  };
145
- var getStrategyAdditionalFields = function (metadata, strategy, mapping, attributeType, currentSurvivorshipGroup) {
135
+ var createRuleTypeData = function (_a) {
136
+ var metadata = _a.metadata, strategy = _a.strategy, mapping = _a.mapping, attributeType = _a.attributeType, currentSurvivorshipGroup = _a.currentSurvivorshipGroup;
146
137
  var fixUri = fixReferencedAttributeUri(attributeType);
147
138
  var primaryAttributeUri = isOtherAttributeWinnerRule(strategy) ? fixUri(mapping === null || mapping === void 0 ? void 0 : mapping.primaryAttributeUri) : undefined;
148
139
  var comparisonAttributeUri = isComplexAttribute(attributeType) && isMinMaxValueRule(strategy)
@@ -152,59 +143,89 @@ var getStrategyAdditionalFields = function (metadata, strategy, mapping, attribu
152
143
  ? uniq(__spreadArray(__spreadArray(__spreadArray([], ((mapping === null || mapping === void 0 ? void 0 : mapping.sourcesUriOrder) || []), true), ((currentSurvivorshipGroup === null || currentSurvivorshipGroup === void 0 ? void 0 : currentSurvivorshipGroup.sourcesUriOrder) || []), true), getSourcesUriOrderFromMetadata(metadata), true))
153
144
  : undefined;
154
145
  return {
155
- primaryAttributeUri: primaryAttributeUri,
156
- comparisonAttributeUri: comparisonAttributeUri,
157
- sourcesUriOrder: sourcesUriOrder
146
+ type: RuleItemType.Rule,
147
+ data: {
148
+ strategy: strategy,
149
+ primaryAttributeUri: primaryAttributeUri,
150
+ comparisonAttributeUri: comparisonAttributeUri,
151
+ sourcesUriOrder: sourcesUriOrder
152
+ }
158
153
  };
159
154
  };
160
- var getAppliedSurvivorshipRules = function (metadata, mapping, attributeType, attributeValues, currentSurvivorshipGroup) {
161
- if (isComplexAttribute(attributeType) || !attributeValues) {
162
- return [];
155
+ var mapAttributeToRuleType = function (_a) {
156
+ var metadata = _a.metadata, attributeType = _a.attributeType, attributeValue = _a.attributeValue, mapping = _a.mapping, currentSurvivorshipGroup = _a.currentSurvivorshipGroup;
157
+ var ovDetails = attributeValue.ovDetails;
158
+ if (!ovDetails) {
159
+ return null;
163
160
  }
164
- return pipe(filter(isOvValue), map(function (value) {
165
- var ovDetails = value.ovDetails;
166
- if (!ovDetails || !ovDetails.appliedSurvivorshipRules) {
167
- return null;
168
- }
169
- if (ovDetails.participationStatus === ParticipationStatus.Strategy) {
170
- return { type: 'rule', data: ovDetails.appliedSurvivorshipRules, valueUri: value.uri };
171
- }
172
- return { type: 'status', data: ovDetails.participationStatus, valueUri: value.uri };
173
- }), reject(isNil), map(function (ruleOrStatus) {
174
- if (ruleOrStatus.type === 'status') {
175
- return ruleOrStatus;
176
- }
177
- var appliedRules = collectRuleNames(ruleOrStatus.data);
161
+ if (ovDetails.participationStatus === ParticipationStatus.Strategy) {
162
+ var appliedRules = collectRuleNames(ovDetails.appliedSurvivorshipRules);
178
163
  var lastRule = getSurvivorshipStrategy(metadata, last(appliedRules));
179
164
  return lastRule
180
- ? {
181
- type: 'rule',
182
- valueUri: ruleOrStatus.valueUri,
183
- data: __assign({ strategy: lastRule }, getStrategyAdditionalFields(metadata, lastRule, mapping, attributeType, currentSurvivorshipGroup))
184
- }
165
+ ? createRuleTypeData({
166
+ metadata: metadata,
167
+ strategy: lastRule,
168
+ mapping: mapping,
169
+ attributeType: attributeType,
170
+ currentSurvivorshipGroup: currentSurvivorshipGroup
171
+ })
185
172
  : null;
186
- }), reject(isNil))(attributeValues);
173
+ }
174
+ return {
175
+ type: RuleItemType.Status,
176
+ data: ovDetails.participationStatus
177
+ };
178
+ };
179
+ var getOvAttributeValues = function (attributeValues) {
180
+ if (!attributeValues) {
181
+ return [];
182
+ }
183
+ return pipe(filter(isOvValue), filter(has('ovDetails')), map(pick(['uri', 'value', 'ovDetails'])))(attributeValues);
187
184
  };
188
- export var getRuleTypeValues = function (metadata, attributeType, parentTypeUri, attributeValues, activeSurvivorshipGroupUri) {
189
- var _a, _b, _c, _d;
185
+ var getRuleTypeValues = function (_a) {
186
+ var _b, _c;
187
+ var metadata = _a.metadata, attributeType = _a.attributeType, parentTypeUri = _a.parentTypeUri, attributeValues = _a.attributeValues, activeSurvivorshipGroupUri = _a.activeSurvivorshipGroupUri;
190
188
  var parentType = __spreadArray(__spreadArray([], metadata.entityTypes, true), (metadata.relationTypes || []), true).find(propEq('uri', parentTypeUri));
191
- var survivorshipGroups = (_a = parentType === null || parentType === void 0 ? void 0 : parentType.survivorshipGroups) !== null && _a !== void 0 ? _a : [];
189
+ var survivorshipGroups = (_b = parentType === null || parentType === void 0 ? void 0 : parentType.survivorshipGroups) !== null && _b !== void 0 ? _b : [];
192
190
  var currentSurvivorshipGroup = (activeSurvivorshipGroupUri && survivorshipGroups.find(propEq('uri', activeSurvivorshipGroupUri))) ||
193
191
  survivorshipGroups.find(propEq('default', true));
194
- var mapping = (_b = currentSurvivorshipGroup === null || currentSurvivorshipGroup === void 0 ? void 0 : currentSurvivorshipGroup.mapping) === null || _b === void 0 ? void 0 : _b.find(propEq('attribute', attributeType.uri));
195
- var defaultRuleType = getSurvivorshipStrategy(metadata, mapping === null || mapping === void 0 ? void 0 : mapping.survivorshipStrategy) || getDefaultSurvivorshipStrategy(metadata);
196
- var appliedSurvivorshipRules = getAppliedSurvivorshipRules(metadata, mapping, attributeType, attributeValues, currentSurvivorshipGroup);
197
- if (appliedSurvivorshipRules.length > 0) {
198
- return { ruleTypes: appliedSurvivorshipRules };
192
+ var mapping = (_c = currentSurvivorshipGroup === null || currentSurvivorshipGroup === void 0 ? void 0 : currentSurvivorshipGroup.mapping) === null || _c === void 0 ? void 0 : _c.find(propEq('attribute', attributeType.uri));
193
+ var defaultSurvivorshipStrategy = getSurvivorshipStrategy(metadata, mapping === null || mapping === void 0 ? void 0 : mapping.survivorshipStrategy) || getDefaultSurvivorshipStrategy(metadata);
194
+ var defaultRuleType = createRuleTypeData({
195
+ metadata: metadata,
196
+ strategy: defaultSurvivorshipStrategy,
197
+ mapping: mapping,
198
+ attributeType: attributeType,
199
+ currentSurvivorshipGroup: currentSurvivorshipGroup
200
+ });
201
+ var ovAttributeValues = getOvAttributeValues(attributeValues);
202
+ var getRuleTypeData = function (attrType, attrValue) {
203
+ var _a, _b;
204
+ if (!(attrValue === null || attrValue === void 0 ? void 0 : attrValue.ovDetails)) {
205
+ return defaultRuleType;
206
+ }
207
+ var mappingForAttr = attrType.uri === attributeType.uri
208
+ ? mapping
209
+ : (_a = currentSurvivorshipGroup === null || currentSurvivorshipGroup === void 0 ? void 0 : currentSurvivorshipGroup.mapping) === null || _a === void 0 ? void 0 : _a.find(propEq('attribute', attrType.uri));
210
+ return ((_b = mapAttributeToRuleType({
211
+ metadata: metadata,
212
+ attributeType: attrType,
213
+ attributeValue: attrValue,
214
+ mapping: mappingForAttr,
215
+ currentSurvivorshipGroup: currentSurvivorshipGroup
216
+ })) !== null && _b !== void 0 ? _b : defaultRuleType);
217
+ };
218
+ if (ovAttributeValues.length > 0) {
219
+ return {
220
+ attributeType: attributeType,
221
+ attributeValues: ovAttributeValues,
222
+ getRuleTypeData: getRuleTypeData
223
+ };
199
224
  }
200
225
  return {
201
- ruleTypes: [
202
- {
203
- type: 'rule',
204
- valueUri: (_d = (_c = attributeValues === null || attributeValues === void 0 ? void 0 : attributeValues[0]) === null || _c === void 0 ? void 0 : _c.uri) !== null && _d !== void 0 ? _d : '',
205
- data: __assign({ strategy: defaultRuleType }, getStrategyAdditionalFields(metadata, defaultRuleType, mapping, attributeType, currentSurvivorshipGroup))
206
- }
207
- ]
226
+ attributeType: attributeType,
227
+ attributeValues: [],
228
+ getRuleTypeData: getRuleTypeData
208
229
  };
209
230
  };
210
231
  export var getWinnerCrosswalks = function (attributeValues, crosswalksMap) {
@@ -249,7 +270,13 @@ var getRowValueForColumn = function (columnId, metadata, parentTypeUri, attribut
249
270
  case 'count':
250
271
  return countAttributeValues(attributeType.type, attributeValues, crosswalksMap);
251
272
  case 'ruleType':
252
- return getRuleTypeValues(metadata, attributeType, parentTypeUri, attributeValues, activeSurvivorshipGroupUri);
273
+ return getRuleTypeValues({
274
+ metadata: metadata,
275
+ attributeType: attributeType,
276
+ parentTypeUri: parentTypeUri,
277
+ attributeValues: attributeValues,
278
+ activeSurvivorshipGroupUri: activeSurvivorshipGroupUri
279
+ });
253
280
  case 'winnerSources':
254
281
  return { crosswalks: getWinnerCrosswalks(attributeValues, crosswalksMap) };
255
282
  default: