@aclymatepackages/modules 1.0.10 → 1.0.13
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/EmissionsChart.js +3 -2
- package/dist/components/EmissionsPieChart.js +3 -2
- package/dist/components/ReportGraphContentLayout.js +7 -6
- package/dist/components/SummaryBlock.js +10 -20
- package/dist/index.js +0 -7
- package/package.json +2 -2
- package/src/components/EmissionsChart.js +2 -1
- package/src/components/EmissionsPieChart.js +2 -1
- package/src/components/ReportGraphContentLayout.js +4 -3
- package/src/components/SummaryBlock.js +6 -14
- package/src/index.js +0 -2
|
@@ -348,7 +348,8 @@ const EmissionsChart = _ref13 => {
|
|
|
348
348
|
showTooltip,
|
|
349
349
|
startDate,
|
|
350
350
|
convertCarbonUnits,
|
|
351
|
-
displayUnitLabel
|
|
351
|
+
displayUnitLabel,
|
|
352
|
+
scopes
|
|
352
353
|
} = _ref13;
|
|
353
354
|
const {
|
|
354
355
|
chartLabelsArray,
|
|
@@ -357,7 +358,7 @@ const EmissionsChart = _ref13 => {
|
|
|
357
358
|
subcategoriesArray,
|
|
358
359
|
period,
|
|
359
360
|
groupedEmissions
|
|
360
|
-
} = (0, _chartHelpers.buildEmissionGroupData)(emissions, graphPeriod, startDate);
|
|
361
|
+
} = (0, _chartHelpers.buildEmissionGroupData)(emissions, graphPeriod, startDate, scopes);
|
|
361
362
|
const isDataProjected = findIsDataProjected(latestEmissionDate);
|
|
362
363
|
const isFirstPeriodEstimated = findIsFirstPeriodEstimated(chartLabelsArray, graphPeriod);
|
|
363
364
|
const buildProjectionObj = viewMode === "subcategories" ? buildSubcategoriesProjectionObj : buildScopesProjectionObj;
|
|
@@ -63,10 +63,11 @@ const EmissionsPieChart = _ref2 => {
|
|
|
63
63
|
let {
|
|
64
64
|
dataArray: emissions,
|
|
65
65
|
viewMode = "subcategories",
|
|
66
|
-
pieChartRef
|
|
66
|
+
pieChartRef,
|
|
67
|
+
scopes
|
|
67
68
|
} = _ref2;
|
|
68
69
|
const subcategoriesArray = (0, _subcategories.buildSubcategoriesArray)(emissions);
|
|
69
|
-
const scopesArray = (0, _subcategories.buildScopesArray)();
|
|
70
|
+
const scopesArray = scopes || (0, _subcategories.buildScopesArray)();
|
|
70
71
|
const emissionsSum = (0, _otherHelpers.sumTonsCo2e)(emissions);
|
|
71
72
|
const formatChartPieSlices = () => {
|
|
72
73
|
const filterFunction = subcategory => emission => {
|
|
@@ -7,7 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _material = require("@mui/material");
|
|
9
9
|
var _EmissionsChart = _interopRequireDefault(require("./EmissionsChart"));
|
|
10
|
-
var _ReportContentTitle = _interopRequireDefault(require("./ReportContentTitle"));
|
|
11
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
11
|
const ReportGraphContentLayout = _ref => {
|
|
13
12
|
let {
|
|
@@ -18,7 +17,8 @@ const ReportGraphContentLayout = _ref => {
|
|
|
18
17
|
emissions,
|
|
19
18
|
interval = "quarter",
|
|
20
19
|
isPercentageChart,
|
|
21
|
-
height
|
|
20
|
+
height,
|
|
21
|
+
scopes
|
|
22
22
|
} = _ref;
|
|
23
23
|
return /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
24
24
|
p: 2,
|
|
@@ -36,9 +36,9 @@ const ReportGraphContentLayout = _ref => {
|
|
|
36
36
|
spacing: 2
|
|
37
37
|
}, /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
38
38
|
item: true
|
|
39
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
40
|
-
|
|
41
|
-
})), contentRows.map((row, idx) => /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
39
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
40
|
+
variant: "subtitle1"
|
|
41
|
+
}, contentTitle)), contentRows.map((row, idx) => /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
42
42
|
item: true,
|
|
43
43
|
key: "content-row-".concat(idx)
|
|
44
44
|
}, row))), /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
@@ -53,7 +53,8 @@ const ReportGraphContentLayout = _ref => {
|
|
|
53
53
|
unitConverter: tons => tons,
|
|
54
54
|
aspect: 2,
|
|
55
55
|
isPercentageChart: isPercentageChart,
|
|
56
|
-
showTooltip: false
|
|
56
|
+
showTooltip: false,
|
|
57
|
+
scopes: scopes
|
|
57
58
|
}))));
|
|
58
59
|
};
|
|
59
60
|
var _default = exports.default = ReportGraphContentLayout;
|
|
@@ -6,40 +6,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _material = require("@mui/material");
|
|
9
|
-
var _formatters = require("@aclymatepackages/formatters");
|
|
10
|
-
var _otherHelpers = require("@aclymatepackages/other-helpers");
|
|
11
9
|
var _emissionsCalcs = require("@aclymatepackages/emissions-calcs");
|
|
10
|
+
var _otherHelpers = require("@aclymatepackages/other-helpers");
|
|
12
11
|
var _EmissionsPieChart = _interopRequireDefault(require("./EmissionsPieChart"));
|
|
13
12
|
var _ReportContentTitle = _interopRequireDefault(require("./ReportContentTitle"));
|
|
14
13
|
var _ReportGraphContentLayout = _interopRequireDefault(require("./ReportGraphContentLayout"));
|
|
15
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
const
|
|
17
|
-
let {
|
|
18
|
-
label,
|
|
19
|
-
emissions
|
|
20
|
-
} = _ref;
|
|
21
|
-
return /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
22
|
-
variant: "body2"
|
|
23
|
-
}, label, ": ", (0, _formatters.formatDecimal)((0, _otherHelpers.sumTonsCo2e)(emissions)), " tons CO2e");
|
|
24
|
-
};
|
|
25
|
-
const SummaryBlock = _ref2 => {
|
|
15
|
+
const SummaryBlock = _ref => {
|
|
26
16
|
let {
|
|
27
17
|
emissions,
|
|
28
18
|
interval
|
|
29
|
-
} =
|
|
19
|
+
} = _ref;
|
|
30
20
|
return /*#__PURE__*/_react.default.createElement(_ReportGraphContentLayout.default, {
|
|
31
|
-
contentTitle:
|
|
21
|
+
contentTitle: (0, _otherHelpers.buildEmissionsSummarySentence)({
|
|
22
|
+
label: "Total Emissions",
|
|
23
|
+
emissions
|
|
24
|
+
}),
|
|
32
25
|
interval: interval,
|
|
33
26
|
emissions: emissions,
|
|
34
27
|
contentRows: [/*#__PURE__*/_react.default.createElement(_EmissionsPieChart.default, {
|
|
35
28
|
dataArray: emissions,
|
|
36
29
|
viewMode: "scopes"
|
|
37
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
38
|
-
|
|
39
|
-
}), /*#__PURE__*/_react.default.createElement(EmissionsSummarySentence, {
|
|
40
|
-
label: "Total Emissions",
|
|
41
|
-
emissions: emissions
|
|
42
|
-
}), [1, 2, 3].map((scope, idx) => /*#__PURE__*/_react.default.createElement(EmissionsSummarySentence, {
|
|
30
|
+
}), /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
31
|
+
variant: "subtitle1"
|
|
32
|
+
}, "Emissions Summary"), [1, 2, 3].map((scope, idx) => /*#__PURE__*/_react.default.createElement(EmissionsSummarySentence, {
|
|
43
33
|
key: "summary-sentence-".concat(idx),
|
|
44
34
|
label: "Total Scope ".concat(scope),
|
|
45
35
|
emissions: (0, _emissionsCalcs.filterEmissionsByScope)(emissions, scope)
|
package/dist/index.js
CHANGED
|
@@ -51,12 +51,6 @@ Object.defineProperty(exports, "EmissionsReductionGraph", {
|
|
|
51
51
|
return _EmissionsReductionGraph.default;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
-
Object.defineProperty(exports, "EmissionsSummarySentence", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function get() {
|
|
57
|
-
return _EmissionsSummarySentence.default;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
54
|
Object.defineProperty(exports, "EmissionsSummaryTable", {
|
|
61
55
|
enumerable: true,
|
|
62
56
|
get: function get() {
|
|
@@ -146,7 +140,6 @@ var _EmissionsCustomTooltip = _interopRequireDefault(require("./components/Emiss
|
|
|
146
140
|
var _EmissionsPieChart = _interopRequireDefault(require("./components/EmissionsPieChart"));
|
|
147
141
|
var _useChartWarningLabels = _interopRequireDefault(require("./components/useChartWarningLabels"));
|
|
148
142
|
var _EmissionsSummaryTable = _interopRequireDefault(require("./components/EmissionsSummaryTable"));
|
|
149
|
-
var _EmissionsSummarySentence = _interopRequireDefault(require("./components/EmissionsSummarySentence"));
|
|
150
143
|
var _ReportContentTitle = _interopRequireDefault(require("./components/ReportContentTitle"));
|
|
151
144
|
var _SummaryBlock = _interopRequireDefault(require("./components/SummaryBlock"));
|
|
152
145
|
var _ReportGraphContentLayout = _interopRequireDefault(require("./components/ReportGraphContentLayout"));
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aclymatepackages/modules",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Aclymate modules",
|
|
5
5
|
"author": "William Loopesko",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@aclymatepackages/array-immutability-helpers": "^1.0.0",
|
|
9
9
|
"@aclymatepackages/atoms": "^1.0.0",
|
|
10
|
-
"@aclymatepackages/chart-helpers": "^1.0.
|
|
10
|
+
"@aclymatepackages/chart-helpers": "^1.0.6",
|
|
11
11
|
"@aclymatepackages/constants": "^1.0.0",
|
|
12
12
|
"@aclymatepackages/converters": "^1.0.0",
|
|
13
13
|
"@aclymatepackages/date-helpers": "^1.0.0",
|
|
@@ -412,6 +412,7 @@ const EmissionsChart = ({
|
|
|
412
412
|
startDate,
|
|
413
413
|
convertCarbonUnits,
|
|
414
414
|
displayUnitLabel,
|
|
415
|
+
scopes,
|
|
415
416
|
}) => {
|
|
416
417
|
const {
|
|
417
418
|
chartLabelsArray,
|
|
@@ -420,7 +421,7 @@ const EmissionsChart = ({
|
|
|
420
421
|
subcategoriesArray,
|
|
421
422
|
period,
|
|
422
423
|
groupedEmissions,
|
|
423
|
-
} = buildEmissionGroupData(emissions, graphPeriod, startDate);
|
|
424
|
+
} = buildEmissionGroupData(emissions, graphPeriod, startDate, scopes);
|
|
424
425
|
|
|
425
426
|
const isDataProjected = findIsDataProjected(latestEmissionDate);
|
|
426
427
|
const isFirstPeriodEstimated = findIsFirstPeriodEstimated(
|
|
@@ -49,9 +49,10 @@ const EmissionsPieChart = ({
|
|
|
49
49
|
dataArray: emissions,
|
|
50
50
|
viewMode = "subcategories",
|
|
51
51
|
pieChartRef,
|
|
52
|
+
scopes,
|
|
52
53
|
}) => {
|
|
53
54
|
const subcategoriesArray = buildSubcategoriesArray(emissions);
|
|
54
|
-
const scopesArray = buildScopesArray();
|
|
55
|
+
const scopesArray = scopes || buildScopesArray();
|
|
55
56
|
|
|
56
57
|
const emissionsSum = sumTonsCo2e(emissions);
|
|
57
58
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import { Box, Grid } from "@mui/material";
|
|
3
|
+
import { Box, Grid, Typography } from "@mui/material";
|
|
4
4
|
|
|
5
5
|
import EmissionsChart from "./EmissionsChart";
|
|
6
|
-
import ReportContentTitle from "./ReportContentTitle";
|
|
7
6
|
|
|
8
7
|
const ReportGraphContentLayout = ({
|
|
9
8
|
contentTitle,
|
|
@@ -14,13 +13,14 @@ const ReportGraphContentLayout = ({
|
|
|
14
13
|
interval = "quarter",
|
|
15
14
|
isPercentageChart,
|
|
16
15
|
height,
|
|
16
|
+
scopes,
|
|
17
17
|
}) => {
|
|
18
18
|
return (
|
|
19
19
|
<Box p={2} style={{ height: height || "auto" }}>
|
|
20
20
|
<Grid container spacing={2}>
|
|
21
21
|
<Grid item sm={4} container direction="column" spacing={2}>
|
|
22
22
|
<Grid item>
|
|
23
|
-
<
|
|
23
|
+
<Typography variant="subtitle1">{contentTitle}</Typography>
|
|
24
24
|
</Grid>
|
|
25
25
|
{contentRows.map((row, idx) => (
|
|
26
26
|
<Grid item key={`content-row-${idx}`}>
|
|
@@ -39,6 +39,7 @@ const ReportGraphContentLayout = ({
|
|
|
39
39
|
aspect={2}
|
|
40
40
|
isPercentageChart={isPercentageChart}
|
|
41
41
|
showTooltip={false}
|
|
42
|
+
scopes={scopes}
|
|
42
43
|
/>
|
|
43
44
|
</Grid>
|
|
44
45
|
</Grid>
|
|
@@ -2,33 +2,25 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
import { Typography } from "@mui/material";
|
|
4
4
|
|
|
5
|
-
import { formatDecimal } from "@aclymatepackages/formatters";
|
|
6
|
-
import { sumTonsCo2e } from "@aclymatepackages/other-helpers";
|
|
7
5
|
import { filterEmissionsByScope } from "@aclymatepackages/emissions-calcs";
|
|
6
|
+
import { buildEmissionsSummarySentence } from "@aclymatepackages/other-helpers";
|
|
8
7
|
|
|
9
8
|
import EmissionsPieChart from "./EmissionsPieChart";
|
|
10
9
|
import ReportContentTitle from "./ReportContentTitle";
|
|
11
10
|
import ReportGraphContentLayout from "./ReportGraphContentLayout";
|
|
12
11
|
|
|
13
|
-
const EmissionsSummarySentence = ({ label, emissions }) => (
|
|
14
|
-
<Typography variant="body2">
|
|
15
|
-
{label}: {formatDecimal(sumTonsCo2e(emissions))} tons CO2e
|
|
16
|
-
</Typography>
|
|
17
|
-
);
|
|
18
|
-
|
|
19
12
|
const SummaryBlock = ({ emissions, interval }) => {
|
|
20
13
|
return (
|
|
21
14
|
<ReportGraphContentLayout
|
|
22
|
-
contentTitle=
|
|
15
|
+
contentTitle={buildEmissionsSummarySentence({
|
|
16
|
+
label: "Total Emissions",
|
|
17
|
+
emissions,
|
|
18
|
+
})}
|
|
23
19
|
interval={interval}
|
|
24
20
|
emissions={emissions}
|
|
25
21
|
contentRows={[
|
|
26
22
|
<EmissionsPieChart dataArray={emissions} viewMode="scopes" />,
|
|
27
|
-
<
|
|
28
|
-
<EmissionsSummarySentence
|
|
29
|
-
label="Total Emissions"
|
|
30
|
-
emissions={emissions}
|
|
31
|
-
/>,
|
|
23
|
+
<Typography variant="subtitle1">Emissions Summary</Typography>,
|
|
32
24
|
[1, 2, 3].map((scope, idx) => (
|
|
33
25
|
<EmissionsSummarySentence
|
|
34
26
|
key={`summary-sentence-${idx}`}
|
package/src/index.js
CHANGED
|
@@ -15,7 +15,6 @@ import EmissionsCustomTooltip from "./components/EmissionsCustomTooltip";
|
|
|
15
15
|
import EmissionsPieChart from "./components/EmissionsPieChart";
|
|
16
16
|
import useChartWarningLabels from "./components/useChartWarningLabels";
|
|
17
17
|
import EmissionsSummaryTable from "./components/EmissionsSummaryTable";
|
|
18
|
-
import EmissionsSummarySentence from "./components/EmissionsSummarySentence";
|
|
19
18
|
import ReportContentTitle from "./components/ReportContentTitle";
|
|
20
19
|
import SummaryBlock from "./components/SummaryBlock";
|
|
21
20
|
import ReportGraphContentLayout from "./components/ReportGraphContentLayout";
|
|
@@ -38,7 +37,6 @@ export {
|
|
|
38
37
|
EmissionsPieChart,
|
|
39
38
|
useChartWarningLabels,
|
|
40
39
|
EmissionsSummaryTable,
|
|
41
|
-
EmissionsSummarySentence,
|
|
42
40
|
ReportContentTitle,
|
|
43
41
|
SummaryBlock,
|
|
44
42
|
ReportGraphContentLayout,
|