@reltio/components 1.4.2227 → 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.
- package/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.d.ts +9 -1
- package/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.js +3 -3
- package/SimpleAttribute/SimpleAttribute.d.ts +5 -2
- package/SimpleAttribute/SimpleAttribute.js +15 -7
- package/SimpleAttribute/SimpleAttribute.module.css.js +9 -0
- package/cjs/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.d.ts +9 -1
- package/cjs/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.js +3 -3
- package/cjs/SimpleAttribute/SimpleAttribute.d.ts +5 -2
- package/cjs/SimpleAttribute/SimpleAttribute.js +19 -11
- package/cjs/SimpleAttribute/SimpleAttribute.module.css.js +9 -0
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.js +3 -1
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +4 -1
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.js +51 -21
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test.js +56 -0
- package/cjs/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.d.ts +7 -0
- package/cjs/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.js +31 -0
- package/cjs/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.module.css.js +9 -0
- package/cjs/features/crosswalks/AttributesTable/components/FallbackIndicator/index.d.ts +1 -0
- package/cjs/features/crosswalks/AttributesTable/components/FallbackIndicator/index.js +5 -0
- package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +3 -1
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.js +1 -1
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.d.ts +1 -1
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.js +65 -11
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.module.css.js +9 -0
- package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.d.ts +7 -0
- package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.js +15 -0
- package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightReporter.d.ts +7 -0
- package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightReporter.js +53 -0
- package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/index.d.ts +2 -0
- package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/index.js +7 -0
- package/cjs/features/crosswalks/AttributesTable/helpers.d.ts +4 -2
- package/cjs/features/crosswalks/AttributesTable/helpers.js +96 -17
- package/cjs/features/crosswalks/AttributesTable/helpers.test.js +499 -50
- package/cjs/features/crosswalks/AttributesTable/types.d.ts +17 -3
- package/cjs/features/crosswalks/contexts/SyncedValueHeightsContext.d.ts +11 -0
- package/cjs/features/crosswalks/contexts/SyncedValueHeightsContext.js +66 -0
- package/features/crosswalks/AttributesTable/AttributesTable.js +3 -1
- package/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +4 -1
- package/features/crosswalks/AttributesTable/AttributesTable.test-data.js +49 -20
- package/features/crosswalks/AttributesTable/AttributesTable.test.js +58 -2
- package/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.d.ts +7 -0
- package/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.js +24 -0
- package/features/crosswalks/AttributesTable/components/FallbackIndicator/FallbackIndicator.module.css.js +9 -0
- package/features/crosswalks/AttributesTable/components/FallbackIndicator/index.d.ts +1 -0
- package/features/crosswalks/AttributesTable/components/FallbackIndicator/index.js +1 -0
- package/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.js +3 -1
- package/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.js +1 -1
- package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.d.ts +1 -1
- package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.js +65 -11
- package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.module.css.js +9 -0
- package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.d.ts +7 -0
- package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.js +8 -0
- package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightReporter.d.ts +7 -0
- package/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightReporter.js +23 -0
- package/features/crosswalks/AttributesTable/components/SyncedValueHeight/index.d.ts +2 -0
- package/features/crosswalks/AttributesTable/components/SyncedValueHeight/index.js +2 -0
- package/features/crosswalks/AttributesTable/helpers.d.ts +4 -2
- package/features/crosswalks/AttributesTable/helpers.js +95 -18
- package/features/crosswalks/AttributesTable/helpers.test.js +501 -52
- package/features/crosswalks/AttributesTable/types.d.ts +17 -3
- package/features/crosswalks/contexts/SyncedValueHeightsContext.d.ts +11 -0
- package/features/crosswalks/contexts/SyncedValueHeightsContext.js +38 -0
- package/package.json +2 -2
- package/SimpleAttribute/styles.d.ts +0 -1
- package/SimpleAttribute/styles.js +0 -42
- package/cjs/SimpleAttribute/styles.d.ts +0 -1
- package/cjs/SimpleAttribute/styles.js +0 -45
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/styles.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/styles.js +0 -13
- package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/styles.d.ts +0 -1
- package/features/crosswalks/AttributesTable/components/RuleTypeRenderer/styles.js +0 -10
package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.js
CHANGED
|
@@ -2,24 +2,78 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
+
var _a;
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
7
|
exports.RuleTypeRenderer = void 0;
|
|
7
8
|
var react_1 = __importDefault(require("react"));
|
|
9
|
+
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
8
10
|
var classnames_1 = __importDefault(require("classnames"));
|
|
11
|
+
var Info_1 = __importDefault(require("@mui/icons-material/Info"));
|
|
12
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
13
|
+
var withTooltip_1 = require("../../../../../HOCs/withTooltip");
|
|
9
14
|
var RuleTypeInfoButton_1 = require("../RuleTypeInfoButton");
|
|
10
15
|
var styles_1 = require("../../styles");
|
|
11
|
-
var
|
|
16
|
+
var SyncedValueHeight_1 = require("../SyncedValueHeight");
|
|
17
|
+
var RuleTypeRenderer_module_css_1 = __importDefault(require("./RuleTypeRenderer.module.css"));
|
|
18
|
+
var InfoIconWithTooltip = (0, withTooltip_1.withTooltip)(Info_1.default);
|
|
19
|
+
var PARTICIPATION_STATUS_MAP = (_a = {},
|
|
20
|
+
Object.defineProperty(_a, mdm_sdk_1.ParticipationStatus.Pinned, {
|
|
21
|
+
get: function () {
|
|
22
|
+
return ui_i18n_1.default.text("Value survives because 'pin' flag is set. Survivorship not evaluated");
|
|
23
|
+
},
|
|
24
|
+
enumerable: false,
|
|
25
|
+
configurable: true
|
|
26
|
+
}),
|
|
27
|
+
Object.defineProperty(_a, mdm_sdk_1.ParticipationStatus.Ignored, {
|
|
28
|
+
get: function () {
|
|
29
|
+
return ui_i18n_1.default.text("Value did not participate in survivorship evaluation because 'ignore' flag is set");
|
|
30
|
+
},
|
|
31
|
+
enumerable: false,
|
|
32
|
+
configurable: true
|
|
33
|
+
}),
|
|
34
|
+
Object.defineProperty(_a, mdm_sdk_1.ParticipationStatus.EndDatedCrosswalk, {
|
|
35
|
+
get: function () {
|
|
36
|
+
return ui_i18n_1.default.text("Value did not participate in survivorship evaluation because it's crosswalk is end-dated");
|
|
37
|
+
},
|
|
38
|
+
enumerable: false,
|
|
39
|
+
configurable: true
|
|
40
|
+
}),
|
|
41
|
+
Object.defineProperty(_a, mdm_sdk_1.ParticipationStatus.NotParticipating, {
|
|
42
|
+
get: function () {
|
|
43
|
+
return ui_i18n_1.default.text('Value did not participate in survivorship evaluation because another value was pinned or the source was ignored');
|
|
44
|
+
},
|
|
45
|
+
enumerable: false,
|
|
46
|
+
configurable: true
|
|
47
|
+
}),
|
|
48
|
+
_a);
|
|
12
49
|
var RuleTypeRenderer = function (_a) {
|
|
13
|
-
var
|
|
14
|
-
var styles = (0, styles_2.useStyles)();
|
|
50
|
+
var ruleTypes = _a.value.ruleTypes;
|
|
15
51
|
var commonStyles = (0, styles_1.useCommonStyles)();
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
52
|
+
var renderStrategy = function (data) {
|
|
53
|
+
var strategy = data.strategy, primaryAttributeUri = data.primaryAttributeUri, comparisonAttributeUri = data.comparisonAttributeUri, sourcesUriOrder = data.sourcesUriOrder;
|
|
54
|
+
if (!strategy)
|
|
55
|
+
return null;
|
|
56
|
+
var showInfoIcon = sourcesUriOrder || primaryAttributeUri || comparisonAttributeUri;
|
|
57
|
+
return (react_1.default.createElement("div", { className: RuleTypeRenderer_module_css_1.default.strategyItem },
|
|
58
|
+
react_1.default.createElement("div", { className: RuleTypeRenderer_module_css_1.default.label }, strategy.label),
|
|
59
|
+
showInfoIcon && (react_1.default.createElement(RuleTypeInfoButton_1.RuleTypeInfoButton, { info: {
|
|
60
|
+
sourcesUriOrder: sourcesUriOrder,
|
|
61
|
+
primaryAttributeUri: primaryAttributeUri,
|
|
62
|
+
comparisonAttributeUri: comparisonAttributeUri
|
|
63
|
+
} }))));
|
|
64
|
+
};
|
|
65
|
+
var renderStatus = function (participationStatus) {
|
|
66
|
+
var description = PARTICIPATION_STATUS_MAP[participationStatus];
|
|
67
|
+
return (react_1.default.createElement("div", { className: RuleTypeRenderer_module_css_1.default.statusItem },
|
|
68
|
+
ui_i18n_1.default.text('N/A'),
|
|
69
|
+
description && react_1.default.createElement(InfoIconWithTooltip, { className: RuleTypeRenderer_module_css_1.default.infoIcon, tooltipTitle: description })));
|
|
70
|
+
};
|
|
71
|
+
var renderRuleType = function (item) {
|
|
72
|
+
if (item.type === 'status') {
|
|
73
|
+
return renderStatus(item.data);
|
|
74
|
+
}
|
|
75
|
+
return renderStrategy(item.data);
|
|
76
|
+
};
|
|
77
|
+
return (react_1.default.createElement("div", { className: (0, classnames_1.default)(RuleTypeRenderer_module_css_1.default.list, commonStyles.basicCell) }, ruleTypes.map(function (item) { return (react_1.default.createElement(SyncedValueHeight_1.ValueHeightConsumer, { key: item.valueUri, uri: item.valueUri }, renderRuleType(item))); })));
|
|
24
78
|
};
|
|
25
79
|
exports.RuleTypeRenderer = RuleTypeRenderer;
|
|
@@ -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
|
+
module.exports = styles;
|
package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightConsumer.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ValueHeightConsumer = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var SyncedValueHeightsContext_1 = require("../../../contexts/SyncedValueHeightsContext");
|
|
9
|
+
var ValueHeightConsumer = function (_a) {
|
|
10
|
+
var uri = _a.uri, children = _a.children;
|
|
11
|
+
var getHeight = (0, SyncedValueHeightsContext_1.useSyncedValueHeights)().getHeight;
|
|
12
|
+
var height = getHeight(uri);
|
|
13
|
+
return react_1.default.createElement("div", { style: height ? { minHeight: height } : undefined }, children);
|
|
14
|
+
};
|
|
15
|
+
exports.ValueHeightConsumer = ValueHeightConsumer;
|
package/cjs/features/crosswalks/AttributesTable/components/SyncedValueHeight/ValueHeightReporter.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ValueHeightReporter = void 0;
|
|
30
|
+
var react_1 = __importStar(require("react"));
|
|
31
|
+
var react_resize_detector_1 = __importDefault(require("react-resize-detector"));
|
|
32
|
+
var SyncedValueHeightsContext_1 = require("../../../contexts/SyncedValueHeightsContext");
|
|
33
|
+
var ValueHeightReporter = function (_a) {
|
|
34
|
+
var uri = _a.uri, children = _a.children;
|
|
35
|
+
var reportHeight = (0, SyncedValueHeightsContext_1.useSyncedValueHeights)().reportHeight;
|
|
36
|
+
var contentRef = (0, react_1.useRef)(null);
|
|
37
|
+
var lastHeightRef = (0, react_1.useRef)();
|
|
38
|
+
var report = (0, react_1.useCallback)(function () {
|
|
39
|
+
var _a;
|
|
40
|
+
var height = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight;
|
|
41
|
+
if (!height || height === lastHeightRef.current)
|
|
42
|
+
return;
|
|
43
|
+
lastHeightRef.current = height;
|
|
44
|
+
reportHeight(uri, height);
|
|
45
|
+
}, [reportHeight, uri, lastHeightRef]);
|
|
46
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
47
|
+
report();
|
|
48
|
+
}, [report]);
|
|
49
|
+
return (react_1.default.createElement("div", { ref: contentRef },
|
|
50
|
+
react_1.default.createElement(react_resize_detector_1.default, { handleHeight: true, onResize: report }),
|
|
51
|
+
children));
|
|
52
|
+
};
|
|
53
|
+
exports.ValueHeightReporter = ValueHeightReporter;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValueHeightReporter = exports.ValueHeightConsumer = void 0;
|
|
4
|
+
var ValueHeightConsumer_1 = require("./ValueHeightConsumer");
|
|
5
|
+
Object.defineProperty(exports, "ValueHeightConsumer", { enumerable: true, get: function () { return ValueHeightConsumer_1.ValueHeightConsumer; } });
|
|
6
|
+
var ValueHeightReporter_1 = require("./ValueHeightReporter");
|
|
7
|
+
Object.defineProperty(exports, "ValueHeightReporter", { enumerable: true, get: function () { return ValueHeightReporter_1.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
|
|
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[];
|
|
@@ -1,4 +1,15 @@
|
|
|
1
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
|
+
};
|
|
2
13
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
14
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
15
|
if (ar || !(i in from)) {
|
|
@@ -12,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
24
|
};
|
|
14
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getBasicTableRowsData = exports.getBasicTableColumnsData = exports.getWinnerCrosswalks = exports.getRuleTypeValues = exports.countAttributeValues = exports.DEFAULT_VISIBLE_COLUMNS = exports.COLUMNS_DATA = void 0;
|
|
26
|
+
exports.getBasicTableRowsData = exports.getBasicTableColumnsData = exports.getWinnerCrosswalks = exports.getRuleTypeValues = exports.getFallbackLabels = exports.collectRuleNames = exports.countAttributeValues = exports.DEFAULT_VISIBLE_COLUMNS = exports.COLUMNS_DATA = void 0;
|
|
16
27
|
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
17
28
|
var ramda_1 = require("ramda");
|
|
18
29
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
@@ -114,27 +125,95 @@ var fixReferencedAttributeUri = (0, ramda_1.curry)(function (parentType, attrTyp
|
|
|
114
125
|
return attrTypeUri;
|
|
115
126
|
}
|
|
116
127
|
});
|
|
117
|
-
var
|
|
118
|
-
|
|
128
|
+
var collectRuleNames = function (rule) {
|
|
129
|
+
if (!rule) {
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
if (typeof rule === 'string') {
|
|
133
|
+
return [rule];
|
|
134
|
+
}
|
|
135
|
+
var entries = Object.entries(rule);
|
|
136
|
+
return entries.flatMap(function (_a) {
|
|
137
|
+
var key = _a[0], value = _a[1];
|
|
138
|
+
return __spreadArray([key], value.flatMap(exports.collectRuleNames), true);
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
exports.collectRuleNames = collectRuleNames;
|
|
142
|
+
var getFallbackLabels = function (metadata, ovDetails) {
|
|
143
|
+
if ((ovDetails === null || ovDetails === void 0 ? void 0 : ovDetails.participationStatus) && ovDetails.participationStatus !== mdm_sdk_1.ParticipationStatus.Strategy) {
|
|
144
|
+
return [];
|
|
145
|
+
}
|
|
146
|
+
var appliedRules = ovDetails === null || ovDetails === void 0 ? void 0 : ovDetails.appliedSurvivorshipRules;
|
|
147
|
+
var rules = (0, exports.collectRuleNames)(appliedRules);
|
|
148
|
+
if (rules.length <= 1) {
|
|
149
|
+
return [];
|
|
150
|
+
}
|
|
151
|
+
return rules.map(function (uri) { var _a; return ((_a = (0, mdm_sdk_1.getSurvivorshipStrategy)(metadata, uri)) === null || _a === void 0 ? void 0 : _a.label) || uri; });
|
|
152
|
+
};
|
|
153
|
+
exports.getFallbackLabels = getFallbackLabels;
|
|
154
|
+
var getStrategyAdditionalFields = function (metadata, strategy, mapping, attributeType, currentSurvivorshipGroup) {
|
|
155
|
+
var fixUri = fixReferencedAttributeUri(attributeType);
|
|
156
|
+
var primaryAttributeUri = isOtherAttributeWinnerRule(strategy) ? fixUri(mapping === null || mapping === void 0 ? void 0 : mapping.primaryAttributeUri) : undefined;
|
|
157
|
+
var comparisonAttributeUri = (0, mdm_sdk_1.isComplexAttribute)(attributeType) && isMinMaxValueRule(strategy)
|
|
158
|
+
? fixUri(mapping === null || mapping === void 0 ? void 0 : mapping.comparisonAttributeUri)
|
|
159
|
+
: undefined;
|
|
160
|
+
var sourcesUriOrder = isSourceSystemRule(strategy)
|
|
161
|
+
? (0, ramda_1.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))
|
|
162
|
+
: undefined;
|
|
163
|
+
return {
|
|
164
|
+
primaryAttributeUri: primaryAttributeUri,
|
|
165
|
+
comparisonAttributeUri: comparisonAttributeUri,
|
|
166
|
+
sourcesUriOrder: sourcesUriOrder
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
var getAppliedSurvivorshipRules = function (metadata, mapping, attributeType, attributeValues, currentSurvivorshipGroup) {
|
|
170
|
+
if ((0, mdm_sdk_1.isComplexAttribute)(attributeType) || !attributeValues) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
return (0, ramda_1.pipe)((0, ramda_1.filter)(isOvValue), (0, ramda_1.map)(function (value) {
|
|
174
|
+
var ovDetails = value.ovDetails;
|
|
175
|
+
if (!ovDetails || !ovDetails.appliedSurvivorshipRules) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
if (ovDetails.participationStatus === mdm_sdk_1.ParticipationStatus.Strategy) {
|
|
179
|
+
return { type: 'rule', data: ovDetails.appliedSurvivorshipRules, valueUri: value.uri };
|
|
180
|
+
}
|
|
181
|
+
return { type: 'status', data: ovDetails.participationStatus, valueUri: value.uri };
|
|
182
|
+
}), (0, ramda_1.reject)(ramda_1.isNil), (0, ramda_1.map)(function (ruleOrStatus) {
|
|
183
|
+
if (ruleOrStatus.type === 'status') {
|
|
184
|
+
return ruleOrStatus;
|
|
185
|
+
}
|
|
186
|
+
var appliedRules = (0, exports.collectRuleNames)(ruleOrStatus.data);
|
|
187
|
+
var lastRule = (0, mdm_sdk_1.getSurvivorshipStrategy)(metadata, (0, ramda_1.last)(appliedRules));
|
|
188
|
+
return lastRule
|
|
189
|
+
? {
|
|
190
|
+
type: 'rule',
|
|
191
|
+
valueUri: ruleOrStatus.valueUri,
|
|
192
|
+
data: __assign({ strategy: lastRule }, getStrategyAdditionalFields(metadata, lastRule, mapping, attributeType, currentSurvivorshipGroup))
|
|
193
|
+
}
|
|
194
|
+
: null;
|
|
195
|
+
}), (0, ramda_1.reject)(ramda_1.isNil))(attributeValues);
|
|
196
|
+
};
|
|
197
|
+
var getRuleTypeValues = function (metadata, attributeType, parentTypeUri, attributeValues, activeSurvivorshipGroupUri) {
|
|
198
|
+
var _a, _b, _c, _d;
|
|
119
199
|
var parentType = __spreadArray(__spreadArray([], metadata.entityTypes, true), (metadata.relationTypes || []), true).find((0, ramda_1.propEq)('uri', parentTypeUri));
|
|
120
200
|
var survivorshipGroups = (_a = parentType === null || parentType === void 0 ? void 0 : parentType.survivorshipGroups) !== null && _a !== void 0 ? _a : [];
|
|
121
201
|
var currentSurvivorshipGroup = (activeSurvivorshipGroupUri && survivorshipGroups.find((0, ramda_1.propEq)('uri', activeSurvivorshipGroupUri))) ||
|
|
122
202
|
survivorshipGroups.find((0, ramda_1.propEq)('default', true));
|
|
123
203
|
var mapping = (_b = currentSurvivorshipGroup === null || currentSurvivorshipGroup === void 0 ? void 0 : currentSurvivorshipGroup.mapping) === null || _b === void 0 ? void 0 : _b.find((0, ramda_1.propEq)('attribute', attributeType.uri));
|
|
124
|
-
var
|
|
125
|
-
var
|
|
126
|
-
|
|
127
|
-
:
|
|
128
|
-
|
|
129
|
-
var primaryAttributeUri = isOtherAttributeWinnerRule(ruleType) ? fixUri(mapping === null || mapping === void 0 ? void 0 : mapping.primaryAttributeUri) : undefined;
|
|
130
|
-
var comparisonAttributeUri = (0, mdm_sdk_1.isComplexAttribute)(attributeType) && isMinMaxValueRule(ruleType)
|
|
131
|
-
? fixUri(mapping === null || mapping === void 0 ? void 0 : mapping.comparisonAttributeUri)
|
|
132
|
-
: undefined;
|
|
204
|
+
var defaultRuleType = (0, mdm_sdk_1.getSurvivorshipStrategy)(metadata, mapping === null || mapping === void 0 ? void 0 : mapping.survivorshipStrategy) || (0, mdm_sdk_1.getDefaultSurvivorshipStrategy)(metadata);
|
|
205
|
+
var appliedSurvivorshipRules = getAppliedSurvivorshipRules(metadata, mapping, attributeType, attributeValues, currentSurvivorshipGroup);
|
|
206
|
+
if (appliedSurvivorshipRules.length > 0) {
|
|
207
|
+
return { ruleTypes: appliedSurvivorshipRules };
|
|
208
|
+
}
|
|
133
209
|
return {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
210
|
+
ruleTypes: [
|
|
211
|
+
{
|
|
212
|
+
type: 'rule',
|
|
213
|
+
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 : '',
|
|
214
|
+
data: __assign({ strategy: defaultRuleType }, getStrategyAdditionalFields(metadata, defaultRuleType, mapping, attributeType, currentSurvivorshipGroup))
|
|
215
|
+
}
|
|
216
|
+
]
|
|
138
217
|
};
|
|
139
218
|
};
|
|
140
219
|
exports.getRuleTypeValues = getRuleTypeValues;
|
|
@@ -181,7 +260,7 @@ var getRowValueForColumn = function (columnId, metadata, parentTypeUri, attribut
|
|
|
181
260
|
case 'count':
|
|
182
261
|
return (0, exports.countAttributeValues)(attributeType.type, attributeValues, crosswalksMap);
|
|
183
262
|
case 'ruleType':
|
|
184
|
-
return (0, exports.getRuleTypeValues)(metadata, attributeType, parentTypeUri, activeSurvivorshipGroupUri);
|
|
263
|
+
return (0, exports.getRuleTypeValues)(metadata, attributeType, parentTypeUri, attributeValues, activeSurvivorshipGroupUri);
|
|
185
264
|
case 'winnerSources':
|
|
186
265
|
return { crosswalks: (0, exports.getWinnerCrosswalks)(attributeValues, crosswalksMap) };
|
|
187
266
|
default:
|