@aclymatepackages/modules 1.0.22 → 1.0.24
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/components/{EmissionsScopeSummarySentence.js → EmissionsSummarySentence.js} +2 -2
- package/dist/components/ReportGraphContentLayout.js +0 -1
- package/dist/components/ReportSummaryBlock.js +4 -5
- package/dist/index.js +3 -10
- package/package.json +1 -1
- package/src/components/{EmissionsScopeSummarySentence.js → EmissionsSummarySentence.js} +2 -2
- package/src/components/ReportGraphContentLayout.js +1 -1
- package/src/components/ReportSummaryBlock.js +9 -6
- package/src/index.js +2 -4
- package/dist/components/EmissionsSummaryTable.js +0 -52
- package/src/components/EmissionsSummaryTable.js +0 -75
|
@@ -9,7 +9,7 @@ var _material = require("@mui/material");
|
|
|
9
9
|
var _atoms = require("@aclymatepackages/atoms");
|
|
10
10
|
var _otherHelpers = require("@aclymatepackages/other-helpers");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
const
|
|
12
|
+
const EmissionsSummarySentence = _ref => {
|
|
13
13
|
let {
|
|
14
14
|
label,
|
|
15
15
|
emissions,
|
|
@@ -37,4 +37,4 @@ const EmissionsScopeSummarySentence = _ref => {
|
|
|
37
37
|
emissions
|
|
38
38
|
}))));
|
|
39
39
|
};
|
|
40
|
-
var _default = exports.default =
|
|
40
|
+
var _default = exports.default = EmissionsSummarySentence;
|
|
@@ -10,10 +10,9 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
var _material = require("@mui/material");
|
|
11
11
|
var _otherHelpers = require("@aclymatepackages/other-helpers");
|
|
12
12
|
var _emissionsCalcs = require("@aclymatepackages/emissions-calcs");
|
|
13
|
-
var _subcategories = require("@aclymatepackages/subcategories");
|
|
14
13
|
var _ReportGraphContentLayout = _interopRequireDefault(require("./ReportGraphContentLayout"));
|
|
15
14
|
var _EmissionsPieChart = _interopRequireDefault(require("./EmissionsPieChart"));
|
|
16
|
-
var
|
|
15
|
+
var _EmissionsSummarySentence = _interopRequireDefault(require("./EmissionsSummarySentence"));
|
|
17
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -25,9 +24,9 @@ const ReportSummaryBlock = _ref => {
|
|
|
25
24
|
emissions,
|
|
26
25
|
interval,
|
|
27
26
|
branding,
|
|
28
|
-
showTooltip
|
|
27
|
+
showTooltip,
|
|
28
|
+
scopesWithColors
|
|
29
29
|
} = _ref;
|
|
30
|
-
const scopesWithColors = (0, _subcategories.buildScopesWithColors)(branding);
|
|
31
30
|
const scopesWithEmissions = scopesWithColors.map(scopeObj => {
|
|
32
31
|
const {
|
|
33
32
|
scope
|
|
@@ -59,7 +58,7 @@ const ReportSummaryBlock = _ref => {
|
|
|
59
58
|
emissions,
|
|
60
59
|
color
|
|
61
60
|
} = _ref2;
|
|
62
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement(_EmissionsSummarySentence.default, {
|
|
63
62
|
key: "summary-sentence-".concat(idx),
|
|
64
63
|
label: "Total Scope ".concat(scope),
|
|
65
64
|
emissions: emissions,
|
package/dist/index.js
CHANGED
|
@@ -51,16 +51,10 @@ Object.defineProperty(exports, "EmissionsReductionGraph", {
|
|
|
51
51
|
return _EmissionsReductionGraph.default;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
-
Object.defineProperty(exports, "
|
|
54
|
+
Object.defineProperty(exports, "EmissionsSummarySentence", {
|
|
55
55
|
enumerable: true,
|
|
56
56
|
get: function get() {
|
|
57
|
-
return
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(exports, "EmissionsSummaryTable", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function get() {
|
|
63
|
-
return _EmissionsSummaryTable.default;
|
|
57
|
+
return _EmissionsSummarySentence.default;
|
|
64
58
|
}
|
|
65
59
|
});
|
|
66
60
|
Object.defineProperty(exports, "FootprintEquivalencies", {
|
|
@@ -139,8 +133,7 @@ var _EmissionsChart = _interopRequireDefault(require("./components/EmissionsChar
|
|
|
139
133
|
var _EmissionsCustomTooltip = _interopRequireDefault(require("./components/EmissionsCustomTooltip"));
|
|
140
134
|
var _EmissionsPieChart = _interopRequireDefault(require("./components/EmissionsPieChart"));
|
|
141
135
|
var _useChartWarningLabels = _interopRequireDefault(require("./components/useChartWarningLabels"));
|
|
142
|
-
var _EmissionsSummaryTable = _interopRequireDefault(require("./components/EmissionsSummaryTable"));
|
|
143
136
|
var _ReportSummaryBlock = _interopRequireDefault(require("./components/ReportSummaryBlock"));
|
|
144
137
|
var _ReportGraphContentLayout = _interopRequireDefault(require("./components/ReportGraphContentLayout"));
|
|
145
|
-
var
|
|
138
|
+
var _EmissionsSummarySentence = _interopRequireDefault(require("./components/EmissionsSummarySentence"));
|
|
146
139
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import { Typography, Grid } from "@mui/material";
|
|
|
5
5
|
import { CategoriesAvatar } from "@aclymatepackages/atoms";
|
|
6
6
|
import { buildEmissionsSummarySentence } from "@aclymatepackages/other-helpers";
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const EmissionsSummarySentence = ({ label, emissions, color, scope }) => (
|
|
9
9
|
<Grid container spacing={1} alignItems="center" wrap="nowrap">
|
|
10
10
|
<Grid item>
|
|
11
11
|
<CategoriesAvatar
|
|
@@ -22,4 +22,4 @@ const EmissionsScopeSummarySentence = ({ label, emissions, color, scope }) => (
|
|
|
22
22
|
</Grid>
|
|
23
23
|
</Grid>
|
|
24
24
|
);
|
|
25
|
-
export default
|
|
25
|
+
export default EmissionsSummarySentence;
|
|
@@ -17,7 +17,7 @@ const ReportGraphContentLayout = ({
|
|
|
17
17
|
showTooltip,
|
|
18
18
|
}) => {
|
|
19
19
|
return (
|
|
20
|
-
<Box
|
|
20
|
+
<Box style={{ height: height || "auto" }}>
|
|
21
21
|
<Grid container spacing={2}>
|
|
22
22
|
<Grid item sm={4} container direction="column" spacing={2}>
|
|
23
23
|
<Grid item>
|
|
@@ -4,15 +4,18 @@ import { Typography } from "@mui/material";
|
|
|
4
4
|
|
|
5
5
|
import { buildEmissionsSummarySentence } from "@aclymatepackages/other-helpers";
|
|
6
6
|
import { filterEmissionsByScope } from "@aclymatepackages/emissions-calcs";
|
|
7
|
-
import { buildScopesWithColors } from "@aclymatepackages/subcategories";
|
|
8
7
|
|
|
9
8
|
import ReportGraphContentLayout from "./ReportGraphContentLayout";
|
|
10
9
|
import EmissionsPieChart from "./EmissionsPieChart";
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
const ReportSummaryBlock = ({ emissions, interval, branding, showTooltip }) => {
|
|
14
|
-
const scopesWithColors = buildScopesWithColors(branding);
|
|
10
|
+
import EmissionsSummarySentence from "./EmissionsSummarySentence";
|
|
15
11
|
|
|
12
|
+
const ReportSummaryBlock = ({
|
|
13
|
+
emissions,
|
|
14
|
+
interval,
|
|
15
|
+
branding,
|
|
16
|
+
showTooltip,
|
|
17
|
+
scopesWithColors,
|
|
18
|
+
}) => {
|
|
16
19
|
const scopesWithEmissions = scopesWithColors.map((scopeObj) => {
|
|
17
20
|
const { scope } = scopeObj;
|
|
18
21
|
const scopeEmissions = filterEmissionsByScope(emissions, scope);
|
|
@@ -38,7 +41,7 @@ const ReportSummaryBlock = ({ emissions, interval, branding, showTooltip }) => {
|
|
|
38
41
|
/>,
|
|
39
42
|
<Typography variant="subtitle1">Emissions Scope Breakdown</Typography>,
|
|
40
43
|
...scopesWithEmissions.map(({ scope, emissions, color }, idx) => (
|
|
41
|
-
<
|
|
44
|
+
<EmissionsSummarySentence
|
|
42
45
|
key={`summary-sentence-${idx}`}
|
|
43
46
|
label={`Total Scope ${scope}`}
|
|
44
47
|
emissions={emissions}
|
package/src/index.js
CHANGED
|
@@ -14,10 +14,9 @@ import EmissionsChart from "./components/EmissionsChart";
|
|
|
14
14
|
import EmissionsCustomTooltip from "./components/EmissionsCustomTooltip";
|
|
15
15
|
import EmissionsPieChart from "./components/EmissionsPieChart";
|
|
16
16
|
import useChartWarningLabels from "./components/useChartWarningLabels";
|
|
17
|
-
import EmissionsSummaryTable from "./components/EmissionsSummaryTable";
|
|
18
17
|
import ReportSummaryBlock from "./components/ReportSummaryBlock";
|
|
19
18
|
import ReportGraphContentLayout from "./components/ReportGraphContentLayout";
|
|
20
|
-
import
|
|
19
|
+
import EmissionsSummarySentence from "./components/EmissionsSummarySentence";
|
|
21
20
|
|
|
22
21
|
export {
|
|
23
22
|
FootprintVideo,
|
|
@@ -36,8 +35,7 @@ export {
|
|
|
36
35
|
EmissionsCustomTooltip,
|
|
37
36
|
EmissionsPieChart,
|
|
38
37
|
useChartWarningLabels,
|
|
39
|
-
EmissionsSummaryTable,
|
|
40
38
|
ReportSummaryBlock,
|
|
41
39
|
ReportGraphContentLayout,
|
|
42
|
-
|
|
40
|
+
EmissionsSummarySentence,
|
|
43
41
|
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _material = require("@mui/material");
|
|
10
|
-
var _chartHelpers = require("@aclymatepackages/chart-helpers");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
const SummaryTableRow = _ref => {
|
|
13
|
-
let {
|
|
14
|
-
name,
|
|
15
|
-
data
|
|
16
|
-
} = _ref;
|
|
17
|
-
return /*#__PURE__*/_react.default.createElement(_material.TableRow, null, /*#__PURE__*/_react.default.createElement(_material.TableCell, null, name), data.map((value, idx) => /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
18
|
-
key: "table-row-cell-".concat(idx)
|
|
19
|
-
}, value)));
|
|
20
|
-
};
|
|
21
|
-
const EmissionsSummaryTable = _ref2 => {
|
|
22
|
-
let {
|
|
23
|
-
emissions,
|
|
24
|
-
rows,
|
|
25
|
-
interval,
|
|
26
|
-
blockTitle,
|
|
27
|
-
tableTitle = "",
|
|
28
|
-
rowType,
|
|
29
|
-
startDate
|
|
30
|
-
} = _ref2;
|
|
31
|
-
const {
|
|
32
|
-
groupedEmissions,
|
|
33
|
-
chartLabelsArray
|
|
34
|
-
} = (0, _chartHelpers.buildEmissionGroupData)(emissions, interval, startDate);
|
|
35
|
-
const summaryTableData = groupedEmissions.map(emission => rowType === "scopes" ? (0, _chartHelpers.buildScopesRealDataObj)(emission) : (0, _chartHelpers.buildSubcategoriesDataObj)(emission));
|
|
36
|
-
return /*#__PURE__*/_react.default.createElement(_material.Box, null, /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
37
|
-
variant: "h6"
|
|
38
|
-
}, blockTitle), /*#__PURE__*/_react.default.createElement(_material.TableContainer, null, /*#__PURE__*/_react.default.createElement(_material.Table, null, /*#__PURE__*/_react.default.createElement(_material.TableHead, null, /*#__PURE__*/_react.default.createElement(_material.TableRow, null, [tableTitle, ...chartLabelsArray].map((label, idx) => /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
39
|
-
key: "table-head-cell-".concat(idx)
|
|
40
|
-
}, label)))), /*#__PURE__*/_react.default.createElement(_material.TableBody, null, rows.map((_ref3, idx) => {
|
|
41
|
-
let {
|
|
42
|
-
name,
|
|
43
|
-
subcategory
|
|
44
|
-
} = _ref3;
|
|
45
|
-
return /*#__PURE__*/_react.default.createElement(SummaryTableRow, {
|
|
46
|
-
name: name,
|
|
47
|
-
data: summaryTableData.map(dataRow => dataRow[subcategory]),
|
|
48
|
-
key: "summary-table-row-".concat(idx)
|
|
49
|
-
});
|
|
50
|
-
})))));
|
|
51
|
-
};
|
|
52
|
-
var _default = exports.default = EmissionsSummaryTable;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
Box,
|
|
4
|
-
Table,
|
|
5
|
-
TableBody,
|
|
6
|
-
TableCell,
|
|
7
|
-
TableContainer,
|
|
8
|
-
TableHead,
|
|
9
|
-
TableRow,
|
|
10
|
-
Typography,
|
|
11
|
-
} from "@mui/material";
|
|
12
|
-
import {
|
|
13
|
-
buildScopesRealDataObj,
|
|
14
|
-
buildSubcategoriesDataObj,
|
|
15
|
-
buildEmissionGroupData,
|
|
16
|
-
} from "@aclymatepackages/chart-helpers";
|
|
17
|
-
|
|
18
|
-
const SummaryTableRow = ({ name, data }) => (
|
|
19
|
-
<TableRow>
|
|
20
|
-
<TableCell>{name}</TableCell>
|
|
21
|
-
{data.map((value, idx) => (
|
|
22
|
-
<TableCell key={`table-row-cell-${idx}`}>{value}</TableCell>
|
|
23
|
-
))}
|
|
24
|
-
</TableRow>
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
const EmissionsSummaryTable = ({
|
|
28
|
-
emissions,
|
|
29
|
-
rows,
|
|
30
|
-
interval,
|
|
31
|
-
blockTitle,
|
|
32
|
-
tableTitle = "",
|
|
33
|
-
rowType,
|
|
34
|
-
startDate,
|
|
35
|
-
}) => {
|
|
36
|
-
const { groupedEmissions, chartLabelsArray } = buildEmissionGroupData(
|
|
37
|
-
emissions,
|
|
38
|
-
interval,
|
|
39
|
-
startDate
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const summaryTableData = groupedEmissions.map((emission) =>
|
|
43
|
-
rowType === "scopes"
|
|
44
|
-
? buildScopesRealDataObj(emission)
|
|
45
|
-
: buildSubcategoriesDataObj(emission)
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<Box>
|
|
50
|
-
<Typography variant="h6">{blockTitle}</Typography>
|
|
51
|
-
<TableContainer>
|
|
52
|
-
<Table>
|
|
53
|
-
<TableHead>
|
|
54
|
-
<TableRow>
|
|
55
|
-
{[tableTitle, ...chartLabelsArray].map((label, idx) => (
|
|
56
|
-
<TableCell key={`table-head-cell-${idx}`}>{label}</TableCell>
|
|
57
|
-
))}
|
|
58
|
-
</TableRow>
|
|
59
|
-
</TableHead>
|
|
60
|
-
<TableBody>
|
|
61
|
-
{rows.map(({ name, subcategory }, idx) => (
|
|
62
|
-
<SummaryTableRow
|
|
63
|
-
name={name}
|
|
64
|
-
data={summaryTableData.map((dataRow) => dataRow[subcategory])}
|
|
65
|
-
key={`summary-table-row-${idx}`}
|
|
66
|
-
/>
|
|
67
|
-
))}
|
|
68
|
-
</TableBody>
|
|
69
|
-
</Table>
|
|
70
|
-
</TableContainer>
|
|
71
|
-
</Box>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export default EmissionsSummaryTable;
|