@reltio/components 1.4.2231 → 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.
- package/InlineComplexAttribute/InlineComplexAttribute.js +2 -2
- package/InlineComplexAttribute/InlineComplexAttribute.test.js +7 -7
- package/ReadOnlyAttributesList/ReadOnlyAttributesList.d.ts +5 -2
- package/ReadOnlyAttributesList/ReadOnlyAttributesList.js +2 -2
- package/ReadOnlyAttributesPager/ReadOnlyAttributesPager.d.ts +5 -2
- package/ReadOnlyAttributesPager/ReadOnlyAttributesPager.js +3 -3
- package/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.d.ts +5 -2
- package/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.js +15 -11
- package/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.d.ts +5 -2
- package/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.js +13 -11
- package/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.d.ts +5 -2
- package/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.js +24 -12
- package/SimpleAttribute/SimpleAttribute.js +3 -2
- package/SyncedValueHeight/ValueHeightConsumer.js +12 -0
- package/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightReporter.js +12 -6
- package/cjs/InlineComplexAttribute/InlineComplexAttribute.js +2 -2
- package/cjs/InlineComplexAttribute/InlineComplexAttribute.test.js +7 -7
- package/cjs/ReadOnlyAttributesList/ReadOnlyAttributesList.d.ts +5 -2
- package/cjs/ReadOnlyAttributesList/ReadOnlyAttributesList.js +2 -2
- package/cjs/ReadOnlyAttributesPager/ReadOnlyAttributesPager.d.ts +5 -2
- package/cjs/ReadOnlyAttributesPager/ReadOnlyAttributesPager.js +3 -3
- package/cjs/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.d.ts +5 -2
- package/cjs/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.js +15 -11
- package/cjs/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.d.ts +5 -2
- package/cjs/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.js +13 -11
- package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.d.ts +5 -2
- package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.js +23 -11
- package/cjs/SimpleAttribute/SimpleAttribute.js +3 -2
- package/cjs/SyncedValueHeight/ValueHeightConsumer.js +39 -0
- package/cjs/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightReporter.js +11 -5
- package/cjs/contexts/AutoExpandedAttributesContext/index.d.ts +8 -0
- package/cjs/contexts/{ExpandedAttributesContext → AutoExpandedAttributesContext}/index.js +8 -8
- package/cjs/contexts/{ExpandedAttributesContext/useAttributeExpanded.test.js → AutoExpandedAttributesContext/useAttributeAutoExpanded.test.js} +3 -3
- package/cjs/contexts/SyncedExpandedAttributesContext/index.d.ts +12 -0
- package/cjs/contexts/SyncedExpandedAttributesContext/index.js +56 -0
- package/{features/crosswalks/contexts/SyncedValueHeightsContext.d.ts → cjs/contexts/SyncedValueHeightsContext/index.d.ts} +2 -2
- package/cjs/{features/crosswalks/contexts/SyncedValueHeightsContext.js → contexts/SyncedValueHeightsContext/index.js} +10 -15
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.js +5 -3
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +1 -1
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.js +93 -34
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test.js +290 -56
- package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.d.ts +11 -0
- package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.js +32 -0
- package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.module.css.js +9 -0
- package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/index.d.ts +1 -0
- package/cjs/features/crosswalks/AttributesTable/components/AttributeRule/index.js +5 -0
- package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.d.ts +10 -0
- package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.js +60 -0
- package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.module.css.js +9 -0
- package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/index.d.ts +1 -0
- package/cjs/features/crosswalks/AttributesTable/components/ComplexRule/index.js +5 -0
- package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +1 -1
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.d.ts +1 -1
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.js +5 -64
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.module.css.js +2 -2
- package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.d.ts +10 -0
- package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.js +94 -0
- package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.module.css.js +9 -0
- package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/index.d.ts +1 -0
- package/cjs/features/crosswalks/AttributesTable/components/SimpleRule/index.js +5 -0
- package/cjs/features/crosswalks/AttributesTable/helpers.d.ts +1 -2
- package/cjs/features/crosswalks/AttributesTable/helpers.js +82 -56
- package/cjs/features/crosswalks/AttributesTable/helpers.test.js +539 -360
- package/cjs/features/crosswalks/AttributesTable/types.d.ts +17 -10
- package/cjs/features/crosswalks/AttributesTable/types.js +6 -0
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +4 -4
- package/contexts/AutoExpandedAttributesContext/index.d.ts +8 -0
- package/contexts/AutoExpandedAttributesContext/index.js +11 -0
- package/contexts/{ExpandedAttributesContext/useAttributeExpanded.test.js → AutoExpandedAttributesContext/useAttributeAutoExpanded.test.js} +4 -4
- package/contexts/SyncedExpandedAttributesContext/index.d.ts +12 -0
- package/contexts/SyncedExpandedAttributesContext/index.js +28 -0
- package/{cjs/features/crosswalks/contexts/SyncedValueHeightsContext.d.ts → contexts/SyncedValueHeightsContext/index.d.ts} +2 -2
- package/{features/crosswalks/contexts/SyncedValueHeightsContext.js → contexts/SyncedValueHeightsContext/index.js} +9 -13
- package/features/crosswalks/AttributesTable/AttributesTable.js +5 -3
- package/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +1 -1
- package/features/crosswalks/AttributesTable/AttributesTable.test-data.js +91 -32
- package/features/crosswalks/AttributesTable/AttributesTable.test.js +291 -57
- package/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.d.ts +11 -0
- package/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.js +25 -0
- package/features/crosswalks/AttributesTable/components/AttributeRule/AttributeRule.module.css.js +9 -0
- package/features/crosswalks/AttributesTable/components/AttributeRule/index.d.ts +1 -0
- package/features/crosswalks/AttributesTable/components/AttributeRule/index.js +1 -0
- package/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.d.ts +10 -0
- package/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.js +30 -0
- package/features/crosswalks/AttributesTable/components/ComplexRule/ComplexRule.module.css.js +9 -0
- package/features/crosswalks/AttributesTable/components/ComplexRule/index.d.ts +1 -0
- package/features/crosswalks/AttributesTable/components/ComplexRule/index.js +1 -0
- package/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +1 -1
- package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.d.ts +1 -1
- package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.js +6 -65
- package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.module.css.js +2 -2
- package/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.d.ts +10 -0
- package/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.js +64 -0
- package/features/crosswalks/AttributesTable/components/SimpleRule/SimpleRule.module.css.js +9 -0
- package/features/crosswalks/AttributesTable/components/SimpleRule/index.d.ts +1 -0
- package/features/crosswalks/AttributesTable/components/SimpleRule/index.js +1 -0
- package/features/crosswalks/AttributesTable/helpers.d.ts +1 -2
- package/features/crosswalks/AttributesTable/helpers.js +82 -55
- package/features/crosswalks/AttributesTable/helpers.test.js +540 -361
- package/features/crosswalks/AttributesTable/types.d.ts +17 -10
- package/features/crosswalks/AttributesTable/types.js +5 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/cjs/contexts/ExpandedAttributesContext/index.d.ts +0 -8
- package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.js +0 -15
- package/contexts/ExpandedAttributesContext/index.d.ts +0 -8
- package/contexts/ExpandedAttributesContext/index.js +0 -11
- package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.js +0 -8
- /package/{cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightConsumer.d.ts +0 -0
- /package/{cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/ValueHeightReporter.d.ts +0 -0
- /package/{cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/index.d.ts +0 -0
- /package/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/index.js +0 -0
- /package/{features/crosswalks/AttributesTable/components → cjs}/SyncedValueHeight/ValueHeightConsumer.d.ts +0 -0
- /package/{features/crosswalks/AttributesTable/components → cjs}/SyncedValueHeight/ValueHeightReporter.d.ts +0 -0
- /package/{features/crosswalks/AttributesTable/components → cjs}/SyncedValueHeight/index.d.ts +0 -0
- /package/cjs/{features/crosswalks/AttributesTable/components/SyncedValueHeight → SyncedValueHeight}/index.js +0 -0
- /package/cjs/contexts/{ExpandedAttributesContext/useAttributeExpanded.test.d.ts → AutoExpandedAttributesContext/useAttributeAutoExpanded.test.d.ts} +0 -0
- /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
|
|
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,
|
|
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
|
|
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
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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
|
|
161
|
-
|
|
162
|
-
|
|
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
|
-
|
|
165
|
-
var
|
|
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
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
165
|
+
? createRuleTypeData({
|
|
166
|
+
metadata: metadata,
|
|
167
|
+
strategy: lastRule,
|
|
168
|
+
mapping: mapping,
|
|
169
|
+
attributeType: attributeType,
|
|
170
|
+
currentSurvivorshipGroup: currentSurvivorshipGroup
|
|
171
|
+
})
|
|
185
172
|
: null;
|
|
186
|
-
}
|
|
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
|
-
|
|
189
|
-
var
|
|
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 = (
|
|
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 = (
|
|
195
|
-
var
|
|
196
|
-
var
|
|
197
|
-
|
|
198
|
-
|
|
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
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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(
|
|
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:
|