@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,3 +1,14 @@
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
+ };
1
12
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
13
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
14
  if (ar || !(i in from)) {
@@ -8,8 +19,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
8
19
  return to.concat(ar || Array.prototype.slice.call(from));
9
20
  };
10
21
  import i18n from 'ui-i18n';
11
- import { assoc, chain, curry, descend, filter, find, flatten, map, pickBy, pipe, prop, propEq, propOr, reduce, sortWith, uniq, uniqBy, values, pathOr } from 'ramda';
12
- import { areOneHierarchyUris, DataTypes, findValueInAttributesByUriSuffix, getBaseUri, getCrosswalksTypes, getDefaultSurvivorshipStrategy, getLastUriPart, getReferencedAttrTypeUrisFromAttrType, getSurvivorshipStrategy, isComplexAttribute, isOv, isReference, isTempUri } from '@reltio/mdm-sdk';
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';
23
+ import { areOneHierarchyUris, DataTypes, findValueInAttributesByUriSuffix, getBaseUri, getCrosswalksTypes, getDefaultSurvivorshipStrategy, getLastUriPart, getReferencedAttrTypeUrisFromAttrType, getSurvivorshipStrategy, isComplexAttribute, isOv, isReference, isTempUri, ParticipationStatus } from '@reltio/mdm-sdk';
13
24
  import { HeadCellRenderer } from './components/HeadCellRenderer';
14
25
  import { AttributesHeadCellRenderer } from './components/AttributesHeadCellRenderer';
15
26
  import { DefaultCellValueRenderer } from './components/DefaultCellValueRenderer';
@@ -107,27 +118,93 @@ var fixReferencedAttributeUri = curry(function (parentType, attrTypeUri) {
107
118
  return attrTypeUri;
108
119
  }
109
120
  });
110
- export var getRuleTypeValues = function (metadata, attributeType, parentTypeUri, activeSurvivorshipGroupUri) {
111
- var _a, _b;
121
+ export var collectRuleNames = function (rule) {
122
+ if (!rule) {
123
+ return [];
124
+ }
125
+ if (typeof rule === 'string') {
126
+ return [rule];
127
+ }
128
+ var entries = Object.entries(rule);
129
+ return entries.flatMap(function (_a) {
130
+ var key = _a[0], value = _a[1];
131
+ return __spreadArray([key], value.flatMap(collectRuleNames), true);
132
+ });
133
+ };
134
+ export var getFallbackLabels = function (metadata, ovDetails) {
135
+ if ((ovDetails === null || ovDetails === void 0 ? void 0 : ovDetails.participationStatus) && ovDetails.participationStatus !== ParticipationStatus.Strategy) {
136
+ return [];
137
+ }
138
+ var appliedRules = ovDetails === null || ovDetails === void 0 ? void 0 : ovDetails.appliedSurvivorshipRules;
139
+ var rules = collectRuleNames(appliedRules);
140
+ if (rules.length <= 1) {
141
+ return [];
142
+ }
143
+ return rules.map(function (uri) { var _a; return ((_a = getSurvivorshipStrategy(metadata, uri)) === null || _a === void 0 ? void 0 : _a.label) || uri; });
144
+ };
145
+ var getStrategyAdditionalFields = function (metadata, strategy, mapping, attributeType, currentSurvivorshipGroup) {
146
+ var fixUri = fixReferencedAttributeUri(attributeType);
147
+ var primaryAttributeUri = isOtherAttributeWinnerRule(strategy) ? fixUri(mapping === null || mapping === void 0 ? void 0 : mapping.primaryAttributeUri) : undefined;
148
+ var comparisonAttributeUri = isComplexAttribute(attributeType) && isMinMaxValueRule(strategy)
149
+ ? fixUri(mapping === null || mapping === void 0 ? void 0 : mapping.comparisonAttributeUri)
150
+ : undefined;
151
+ var sourcesUriOrder = isSourceSystemRule(strategy)
152
+ ? 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
+ : undefined;
154
+ return {
155
+ primaryAttributeUri: primaryAttributeUri,
156
+ comparisonAttributeUri: comparisonAttributeUri,
157
+ sourcesUriOrder: sourcesUriOrder
158
+ };
159
+ };
160
+ var getAppliedSurvivorshipRules = function (metadata, mapping, attributeType, attributeValues, currentSurvivorshipGroup) {
161
+ if (isComplexAttribute(attributeType) || !attributeValues) {
162
+ return [];
163
+ }
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);
178
+ var lastRule = getSurvivorshipStrategy(metadata, last(appliedRules));
179
+ return lastRule
180
+ ? {
181
+ type: 'rule',
182
+ valueUri: ruleOrStatus.valueUri,
183
+ data: __assign({ strategy: lastRule }, getStrategyAdditionalFields(metadata, lastRule, mapping, attributeType, currentSurvivorshipGroup))
184
+ }
185
+ : null;
186
+ }), reject(isNil))(attributeValues);
187
+ };
188
+ export var getRuleTypeValues = function (metadata, attributeType, parentTypeUri, attributeValues, activeSurvivorshipGroupUri) {
189
+ var _a, _b, _c, _d;
112
190
  var parentType = __spreadArray(__spreadArray([], metadata.entityTypes, true), (metadata.relationTypes || []), true).find(propEq('uri', parentTypeUri));
113
191
  var survivorshipGroups = (_a = parentType === null || parentType === void 0 ? void 0 : parentType.survivorshipGroups) !== null && _a !== void 0 ? _a : [];
114
192
  var currentSurvivorshipGroup = (activeSurvivorshipGroupUri && survivorshipGroups.find(propEq('uri', activeSurvivorshipGroupUri))) ||
115
193
  survivorshipGroups.find(propEq('default', true));
116
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));
117
- var ruleType = getSurvivorshipStrategy(metadata, mapping === null || mapping === void 0 ? void 0 : mapping.survivorshipStrategy) || getDefaultSurvivorshipStrategy(metadata);
118
- var sourcesUriOrder = isSourceSystemRule(ruleType)
119
- ? 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))
120
- : undefined;
121
- var fixUri = fixReferencedAttributeUri(attributeType);
122
- var primaryAttributeUri = isOtherAttributeWinnerRule(ruleType) ? fixUri(mapping === null || mapping === void 0 ? void 0 : mapping.primaryAttributeUri) : undefined;
123
- var comparisonAttributeUri = isComplexAttribute(attributeType) && isMinMaxValueRule(ruleType)
124
- ? fixUri(mapping === null || mapping === void 0 ? void 0 : mapping.comparisonAttributeUri)
125
- : undefined;
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 };
199
+ }
126
200
  return {
127
- ruleType: ruleType,
128
- sourcesUriOrder: sourcesUriOrder,
129
- primaryAttributeUri: primaryAttributeUri,
130
- comparisonAttributeUri: comparisonAttributeUri
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
+ ]
131
208
  };
132
209
  };
133
210
  export var getWinnerCrosswalks = function (attributeValues, crosswalksMap) {
@@ -172,7 +249,7 @@ var getRowValueForColumn = function (columnId, metadata, parentTypeUri, attribut
172
249
  case 'count':
173
250
  return countAttributeValues(attributeType.type, attributeValues, crosswalksMap);
174
251
  case 'ruleType':
175
- return getRuleTypeValues(metadata, attributeType, parentTypeUri, activeSurvivorshipGroupUri);
252
+ return getRuleTypeValues(metadata, attributeType, parentTypeUri, attributeValues, activeSurvivorshipGroupUri);
176
253
  case 'winnerSources':
177
254
  return { crosswalks: getWinnerCrosswalks(attributeValues, crosswalksMap) };
178
255
  default: