@hestia-earth/ui-components-charts 0.43.33 → 0.43.35
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/dist/index.js +16 -14
- package/dist/index.mjs +16 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1539,11 +1539,8 @@ var operationOf = (eru, modelId) => eru.operation ? [
|
|
|
1539
1539
|
weightedValue: eru.value
|
|
1540
1540
|
}
|
|
1541
1541
|
] : [];
|
|
1542
|
-
var inputsOf = (
|
|
1543
|
-
|
|
1544
|
-
var _a;
|
|
1545
|
-
return eru.term["@id"] === contributor && ((_a = eru.inputs) == null ? void 0 : _a.length);
|
|
1546
|
-
}).reduce(
|
|
1542
|
+
var inputsOf = (emissionsResourceUse, modelId) => Object.values(
|
|
1543
|
+
emissionsResourceUse.reduce(
|
|
1547
1544
|
(acc, eru) => {
|
|
1548
1545
|
var _a;
|
|
1549
1546
|
const inputId = eru.inputs.map((i) => i["@id"]).join(";");
|
|
@@ -1567,7 +1564,11 @@ var inputsOf = (impactAssessment, contributor, modelId) => Object.values(
|
|
|
1567
1564
|
{}
|
|
1568
1565
|
)
|
|
1569
1566
|
);
|
|
1570
|
-
var
|
|
1567
|
+
var groupBy = (values, keyOf) => values.reduce(
|
|
1568
|
+
(map, value) => map.set(keyOf(value), [...map.get(keyOf(value)) || [], value]),
|
|
1569
|
+
/* @__PURE__ */ new Map()
|
|
1570
|
+
);
|
|
1571
|
+
var parseLogValues = (erusByContributor, values) => {
|
|
1571
1572
|
const log = values[0];
|
|
1572
1573
|
const weightedValue = values.reduce((total, curr) => total + curr.weightedValue, 0);
|
|
1573
1574
|
const value = values.reduce((total, curr) => total + curr.value, 0);
|
|
@@ -1575,7 +1576,7 @@ var parseLogValues = (impactAssessment, values) => {
|
|
|
1575
1576
|
...log,
|
|
1576
1577
|
weightedValue,
|
|
1577
1578
|
value,
|
|
1578
|
-
inputs: inputsOf(
|
|
1579
|
+
inputs: inputsOf(erusByContributor.get(log.contributor) || [], log.modelId)
|
|
1579
1580
|
};
|
|
1580
1581
|
};
|
|
1581
1582
|
var processContributions = (record, nodes) => Object.entries(record || {}).flatMap(([index, byIndicator]) => {
|
|
@@ -1594,14 +1595,15 @@ var hierarchyContributions = (impactAssessment, stored) => {
|
|
|
1594
1595
|
...processContributions(stored == null ? void 0 : stored.emissionsResourceUse, impactAssessment.emissionsResourceUse || []),
|
|
1595
1596
|
...processContributions(stored == null ? void 0 : stored.impacts, impactAssessment.impacts || [])
|
|
1596
1597
|
].filter(Boolean);
|
|
1597
|
-
const grouped = logs.
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1598
|
+
const grouped = groupBy(logs, (log) => [log.indicator, log.contributor, log.modelId].join("/"));
|
|
1599
|
+
const erusByContributor = groupBy(
|
|
1600
|
+
(impactAssessment.emissionsResourceUse || []).filter((eru) => {
|
|
1601
|
+
var _a;
|
|
1602
|
+
return (_a = eru.inputs) == null ? void 0 : _a.length;
|
|
1603
|
+
}),
|
|
1604
|
+
(eru) => eru.term["@id"]
|
|
1603
1605
|
);
|
|
1604
|
-
return
|
|
1606
|
+
return [...grouped.values()].map((values) => parseLogValues(erusByContributor, values));
|
|
1605
1607
|
};
|
|
1606
1608
|
var missingTermIds = (logs, terms = {}) => utils.unique(logs.flatMap((l) => {
|
|
1607
1609
|
var _a;
|
package/dist/index.mjs
CHANGED
|
@@ -1528,11 +1528,8 @@ var operationOf = (eru, modelId) => eru.operation ? [
|
|
|
1528
1528
|
weightedValue: eru.value
|
|
1529
1529
|
}
|
|
1530
1530
|
] : [];
|
|
1531
|
-
var inputsOf = (
|
|
1532
|
-
|
|
1533
|
-
var _a;
|
|
1534
|
-
return eru.term["@id"] === contributor && ((_a = eru.inputs) == null ? void 0 : _a.length);
|
|
1535
|
-
}).reduce(
|
|
1531
|
+
var inputsOf = (emissionsResourceUse, modelId) => Object.values(
|
|
1532
|
+
emissionsResourceUse.reduce(
|
|
1536
1533
|
(acc, eru) => {
|
|
1537
1534
|
var _a;
|
|
1538
1535
|
const inputId = eru.inputs.map((i) => i["@id"]).join(";");
|
|
@@ -1556,7 +1553,11 @@ var inputsOf = (impactAssessment, contributor, modelId) => Object.values(
|
|
|
1556
1553
|
{}
|
|
1557
1554
|
)
|
|
1558
1555
|
);
|
|
1559
|
-
var
|
|
1556
|
+
var groupBy = (values, keyOf) => values.reduce(
|
|
1557
|
+
(map, value) => map.set(keyOf(value), [...map.get(keyOf(value)) || [], value]),
|
|
1558
|
+
/* @__PURE__ */ new Map()
|
|
1559
|
+
);
|
|
1560
|
+
var parseLogValues = (erusByContributor, values) => {
|
|
1560
1561
|
const log = values[0];
|
|
1561
1562
|
const weightedValue = values.reduce((total, curr) => total + curr.weightedValue, 0);
|
|
1562
1563
|
const value = values.reduce((total, curr) => total + curr.value, 0);
|
|
@@ -1564,7 +1565,7 @@ var parseLogValues = (impactAssessment, values) => {
|
|
|
1564
1565
|
...log,
|
|
1565
1566
|
weightedValue,
|
|
1566
1567
|
value,
|
|
1567
|
-
inputs: inputsOf(
|
|
1568
|
+
inputs: inputsOf(erusByContributor.get(log.contributor) || [], log.modelId)
|
|
1568
1569
|
};
|
|
1569
1570
|
};
|
|
1570
1571
|
var processContributions = (record, nodes) => Object.entries(record || {}).flatMap(([index, byIndicator]) => {
|
|
@@ -1583,14 +1584,15 @@ var hierarchyContributions = (impactAssessment, stored) => {
|
|
|
1583
1584
|
...processContributions(stored == null ? void 0 : stored.emissionsResourceUse, impactAssessment.emissionsResourceUse || []),
|
|
1584
1585
|
...processContributions(stored == null ? void 0 : stored.impacts, impactAssessment.impacts || [])
|
|
1585
1586
|
].filter(Boolean);
|
|
1586
|
-
const grouped = logs.
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1587
|
+
const grouped = groupBy(logs, (log) => [log.indicator, log.contributor, log.modelId].join("/"));
|
|
1588
|
+
const erusByContributor = groupBy(
|
|
1589
|
+
(impactAssessment.emissionsResourceUse || []).filter((eru) => {
|
|
1590
|
+
var _a;
|
|
1591
|
+
return (_a = eru.inputs) == null ? void 0 : _a.length;
|
|
1592
|
+
}),
|
|
1593
|
+
(eru) => eru.term["@id"]
|
|
1592
1594
|
);
|
|
1593
|
-
return
|
|
1595
|
+
return [...grouped.values()].map((values) => parseLogValues(erusByContributor, values));
|
|
1594
1596
|
};
|
|
1595
1597
|
var missingTermIds = (logs, terms = {}) => unique(logs.flatMap((l) => {
|
|
1596
1598
|
var _a;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hestia-earth/ui-components-charts",
|
|
3
|
-
"version": "0.43.
|
|
3
|
+
"version": "0.43.35",
|
|
4
4
|
"description": "The charts of the HESTIA platform without Angular or a stylesheet: their data, Chart.js configuration, plugins, d3 hierarchy and exports",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|