@targetprocess/relations-renderer 1.0.2-us456648-child2.3 → 1.2.0-rc.1
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.
|
@@ -6,19 +6,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
var arrow_1 = __importDefault(require("./arrow"));
|
|
7
7
|
function buildArrows(cards, relations, validationStrategy) {
|
|
8
8
|
var cardsGroupedByEntityId = cards.reduce(function (acc, card) {
|
|
9
|
-
var
|
|
9
|
+
var cardKey = getEntityKey(card.getEntityType(), card.getEntityId());
|
|
10
|
+
var cardsWithSimilarEntityId = acc.get(cardKey) || [];
|
|
10
11
|
cardsWithSimilarEntityId.push(card);
|
|
11
|
-
return acc.set(
|
|
12
|
+
return acc.set(cardKey, cardsWithSimilarEntityId);
|
|
12
13
|
}, new Map());
|
|
13
14
|
var result = [];
|
|
14
15
|
relations.forEach(function (relation) {
|
|
15
16
|
var amountOfArrowsForRelation = 0;
|
|
16
|
-
var masterCards = cardsGroupedByEntityId.get(relation.masterEntityId) || [];
|
|
17
|
+
var masterCards = cardsGroupedByEntityId.get(getEntityKey(relation.masterEntityType, relation.masterEntityId)) || [];
|
|
17
18
|
masterCards.forEach(function (masterCard) {
|
|
18
19
|
if (!masterCard.isVisible()) {
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
21
|
-
var slaveCards = cardsGroupedByEntityId.get(relation.slaveEntityId) || [];
|
|
22
|
+
var slaveCards = cardsGroupedByEntityId.get(getEntityKey(relation.slaveEntityType, relation.slaveEntityId)) || [];
|
|
22
23
|
slaveCards.forEach(function (slaveCard) {
|
|
23
24
|
if (!slaveCard.isVisible()) {
|
|
24
25
|
return;
|
|
@@ -33,3 +34,6 @@ function buildArrows(cards, relations, validationStrategy) {
|
|
|
33
34
|
return result;
|
|
34
35
|
}
|
|
35
36
|
exports.default = buildArrows;
|
|
37
|
+
function getEntityKey(entityType, entityId) {
|
|
38
|
+
return (entityType === null || entityType === void 0 ? void 0 : entityType.toLowerCase()) + "_" + entityId;
|
|
39
|
+
}
|
package/dist/cards/card.js
CHANGED
|
@@ -24,6 +24,7 @@ var Card = /** @class */ (function () {
|
|
|
24
24
|
};
|
|
25
25
|
Card.prototype.equals = function (anotherCard) {
|
|
26
26
|
return this.getEntityId() === anotherCard.getEntityId() &&
|
|
27
|
+
this.getEntityType() === anotherCard.getEntityType() &&
|
|
27
28
|
this.getElement() === anotherCard.getElement() &&
|
|
28
29
|
this.isVisible() === anotherCard.isVisible();
|
|
29
30
|
};
|
package/dist/relations.d.ts
CHANGED