@widergy/utilitygo-smart-bill-web 3.21.0 → 3.22.0
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/CHANGELOG.md +7 -0
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionComparison/index.js +49 -16
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/components/ConsumptionComparison/styles.module.scss +25 -2
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/index.js +6 -1
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/utils.js +13 -1
- package/dist/components/SmartBillSummary/tabs/Consumptions/components/ProgressBarCard/components/ProgressBarItem/index.js +12 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [3.22.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v3.21.0...v3.22.0) (2026-01-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* [EVEP-366] smartbill changes ([#80](https://github.com/widergy/UtilityGO-Smart-Bill-Web/issues/80)) ([f3e74eb](https://github.com/widergy/UtilityGO-Smart-Bill-Web/commit/f3e74ebe37a182281e3ff64c762f92b44423b4d9))
|
|
7
|
+
|
|
1
8
|
# [3.21.0](https://github.com/widergy/UtilityGO-Smart-Bill-Web/compare/v3.20.2...v3.21.0) (2026-01-21)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -8,6 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _energyUi = require("@widergy/energy-ui");
|
|
9
9
|
var _billDataTypes = require("@widergy/utilitygo-smart-bill-web/dist/shared/types/billDataTypes");
|
|
10
10
|
var _propTypes = require("prop-types");
|
|
11
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
11
12
|
var _utils = require("./utils");
|
|
12
13
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
13
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -15,39 +16,49 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
15
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
17
|
const ConsumptionComparison = _ref => {
|
|
17
18
|
let {
|
|
18
|
-
|
|
19
|
+
currentPeriods = [],
|
|
20
|
+
referencePeriods = [],
|
|
19
21
|
texts
|
|
20
22
|
} = _ref;
|
|
21
|
-
const
|
|
23
|
+
const allPeriods = [...currentPeriods, ...referencePeriods];
|
|
24
|
+
const maxValue = (0, _utils.getMaxValue)(allPeriods);
|
|
22
25
|
const title = texts?.consumptions?.comparisonTitle;
|
|
23
|
-
const showComparison =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
const showComparison = allPeriods?.length > 1;
|
|
27
|
+
const sortedCurrentPeriods = [...currentPeriods].sort((a, b) => {
|
|
28
|
+
const dateA = (0, _dayjs.default)(a.settlements?.start_date);
|
|
29
|
+
const dateB = (0, _dayjs.default)(b.settlements?.start_date);
|
|
30
|
+
return dateB.diff(dateA);
|
|
31
|
+
});
|
|
32
|
+
const currentPeriodsList = sortedCurrentPeriods.map(period => ({
|
|
33
|
+
...period,
|
|
34
|
+
isCurrent: true
|
|
35
|
+
}));
|
|
36
|
+
const referencePeriodsList = referencePeriods.map(period => ({
|
|
37
|
+
...period,
|
|
38
|
+
isCurrent: false
|
|
39
|
+
}));
|
|
40
|
+
const renderBar = _ref2 => {
|
|
31
41
|
let {
|
|
32
42
|
consumptions,
|
|
33
|
-
current,
|
|
34
43
|
number,
|
|
35
44
|
settlements,
|
|
36
|
-
year
|
|
45
|
+
year,
|
|
46
|
+
isCurrent
|
|
37
47
|
} = _ref2;
|
|
38
48
|
const {
|
|
39
49
|
value,
|
|
40
50
|
unit
|
|
41
51
|
} = consumptions?.[0] || {};
|
|
42
52
|
const barHeight = (0, _utils.getBarHeight)(maxValue, value);
|
|
53
|
+
const key = `${isCurrent ? 'current' : 'reference'}-${number}-${year}`;
|
|
43
54
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
44
|
-
key:
|
|
55
|
+
key: key,
|
|
45
56
|
className: _stylesModule.default.barContainer
|
|
46
57
|
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
47
58
|
className: _stylesModule.default.value,
|
|
48
59
|
variant: "small"
|
|
49
60
|
}, (0, _utils.getFormattedValue)(value, unit)), /*#__PURE__*/_react.default.createElement("div", {
|
|
50
|
-
className: `${_stylesModule.default.bar} ${
|
|
61
|
+
className: `${_stylesModule.default.bar} ${isCurrent ? _stylesModule.default.currentBar : ''}`,
|
|
51
62
|
style: {
|
|
52
63
|
height: `${barHeight}px`
|
|
53
64
|
}
|
|
@@ -60,10 +71,32 @@ const ConsumptionComparison = _ref => {
|
|
|
60
71
|
colorTheme: "gray",
|
|
61
72
|
variant: "small"
|
|
62
73
|
}, (0, _utils.getPeriod)(settlements)));
|
|
63
|
-
}
|
|
74
|
+
};
|
|
75
|
+
const currentCount = currentPeriodsList.length || 1;
|
|
76
|
+
const referenceCount = referencePeriodsList.length || 1;
|
|
77
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
78
|
+
colorTheme: "gray",
|
|
79
|
+
className: showComparison ? _stylesModule.default.consumptionComparisonLabel : _stylesModule.default.consumptionComparisonLabelNoData,
|
|
80
|
+
variant: "small"
|
|
81
|
+
}, title), showComparison && /*#__PURE__*/_react.default.createElement("div", {
|
|
82
|
+
className: _stylesModule.default.containerWrapper
|
|
83
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
84
|
+
className: _stylesModule.default.container
|
|
85
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
86
|
+
className: _stylesModule.default.leftGroup,
|
|
87
|
+
style: {
|
|
88
|
+
flex: currentCount
|
|
89
|
+
}
|
|
90
|
+
}, currentPeriodsList.map(renderBar)), /*#__PURE__*/_react.default.createElement("div", {
|
|
91
|
+
className: _stylesModule.default.rightGroup,
|
|
92
|
+
style: {
|
|
93
|
+
flex: referenceCount
|
|
94
|
+
}
|
|
95
|
+
}, referencePeriodsList.map(renderBar)))));
|
|
64
96
|
};
|
|
65
97
|
ConsumptionComparison.propTypes = {
|
|
66
|
-
|
|
98
|
+
currentPeriods: _billDataTypes.periodsTypes,
|
|
99
|
+
referencePeriods: _billDataTypes.periodsTypes,
|
|
67
100
|
texts: _propTypes.object
|
|
68
101
|
};
|
|
69
102
|
var _default = exports.default = ConsumptionComparison;
|
|
@@ -3,17 +3,37 @@
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
.consumptionComparisonLabelNoData {
|
|
6
|
-
margin: 12px 0
|
|
6
|
+
margin: 12px 0 0 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.containerWrapper {
|
|
10
|
+
width: 100%;
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
.container {
|
|
10
14
|
align-items: flex-end;
|
|
11
15
|
display: flex;
|
|
12
|
-
|
|
16
|
+
gap: 32px;
|
|
13
17
|
height: 240px;
|
|
14
18
|
justify-content: center;
|
|
15
19
|
}
|
|
16
20
|
|
|
21
|
+
.leftGroup,
|
|
22
|
+
.rightGroup {
|
|
23
|
+
align-items: flex-end;
|
|
24
|
+
display: flex;
|
|
25
|
+
grid-gap: 16px;
|
|
26
|
+
height: 100%;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.leftGroup {
|
|
30
|
+
justify-content: flex-end;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.rightGroup {
|
|
34
|
+
justify-content: flex-start;
|
|
35
|
+
}
|
|
36
|
+
|
|
17
37
|
.barContainer {
|
|
18
38
|
align-items: center;
|
|
19
39
|
display: flex;
|
|
@@ -35,6 +55,7 @@
|
|
|
35
55
|
}
|
|
36
56
|
|
|
37
57
|
.value {
|
|
58
|
+
align-items: center;
|
|
38
59
|
margin: 12px 0 4px;
|
|
39
60
|
}
|
|
40
61
|
|
|
@@ -43,5 +64,7 @@
|
|
|
43
64
|
}
|
|
44
65
|
|
|
45
66
|
.period {
|
|
67
|
+
align-items: center;
|
|
46
68
|
color: var(--gray02);
|
|
69
|
+
max-height: 20px;
|
|
47
70
|
}
|
package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/index.js
CHANGED
|
@@ -23,6 +23,10 @@ const CurrentConsumption = _ref => {
|
|
|
23
23
|
periods
|
|
24
24
|
} = smartBill || {};
|
|
25
25
|
const periodsToCompare = (0, _utils.getConsumptionPeriodsToCompare)(periods);
|
|
26
|
+
const {
|
|
27
|
+
currentPeriods = [],
|
|
28
|
+
referencePeriods = []
|
|
29
|
+
} = (0, _utils.getPeriodsGroupedByReference)(periods) || {};
|
|
26
30
|
const {
|
|
27
31
|
totalConsumptionFormatted,
|
|
28
32
|
unit,
|
|
@@ -48,7 +52,8 @@ const CurrentConsumption = _ref => {
|
|
|
48
52
|
colorTheme: "gray",
|
|
49
53
|
withMarkdown: true
|
|
50
54
|
}, description)), /*#__PURE__*/_react.default.createElement(_ConsumptionComparison.default, {
|
|
51
|
-
|
|
55
|
+
currentPeriods: currentPeriods,
|
|
56
|
+
referencePeriods: referencePeriods,
|
|
52
57
|
texts: texts
|
|
53
58
|
}), /*#__PURE__*/_react.default.createElement(_ConsumptionEvolution.default, {
|
|
54
59
|
assets: assets,
|
package/dist/components/SmartBillSummary/tabs/Consumptions/components/CurrentConsumption/utils.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getConsumptionPeriodsToCompare = exports.getConsumptionLabels = void 0;
|
|
6
|
+
exports.getPeriodsGroupedByReference = exports.getConsumptionPeriodsToCompare = exports.getConsumptionLabels = void 0;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
8
|
var _numeral = _interopRequireDefault(require("numeral"));
|
|
9
9
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
@@ -19,6 +19,18 @@ const getConsumptionPeriodsToCompare = function () {
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
exports.getConsumptionPeriodsToCompare = getConsumptionPeriodsToCompare;
|
|
22
|
+
const getPeriodsGroupedByReference = function () {
|
|
23
|
+
let periods = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
24
|
+
if (!(0, _lodash.isEmpty)(periods)) {
|
|
25
|
+
const currentPeriods = periods.filter(period => period.reference_period === false);
|
|
26
|
+
const referencePeriods = periods.filter(period => period.reference_period === true);
|
|
27
|
+
return {
|
|
28
|
+
currentPeriods,
|
|
29
|
+
referencePeriods
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.getPeriodsGroupedByReference = getPeriodsGroupedByReference;
|
|
22
34
|
const formatDate = date => {
|
|
23
35
|
if (!date) return '';
|
|
24
36
|
const day = (0, _dayjs.default)(date).format('D');
|
|
@@ -31,7 +31,11 @@ const ProgressBarItem = _ref => {
|
|
|
31
31
|
} = item;
|
|
32
32
|
const safeSplit = Math.max(0, Math.min(100, Math.floor(splitPoint)));
|
|
33
33
|
const barColorClass = isExceeded ? min ? _stylesModule.default[`split-min-${safeSplit}`] : _stylesModule.default[`split-max-${safeSplit}`] : isPositiveExcess ? _stylesModule.default[`split-positive-${safeSplit}`] : _stylesModule.default.barNormal;
|
|
34
|
-
const
|
|
34
|
+
const isRegisteredLarger = registered.value >= limit.value;
|
|
35
|
+
const leftData = isRegisteredLarger ? limit : registered;
|
|
36
|
+
const rightData = isRegisteredLarger ? registered : limit;
|
|
37
|
+
const leftColor = !isRegisteredLarger && isExceeded ? 'error' : 'gray';
|
|
38
|
+
const rightColor = isRegisteredLarger && isExceeded ? 'error' : 'gray';
|
|
35
39
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
36
40
|
key: id,
|
|
37
41
|
className: _stylesModule.default.card
|
|
@@ -53,20 +57,22 @@ const ProgressBarItem = _ref => {
|
|
|
53
57
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
54
58
|
className: _stylesModule.default.valueGroup
|
|
55
59
|
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
56
|
-
colorTheme:
|
|
60
|
+
colorTheme: leftColor,
|
|
57
61
|
variant: "title1"
|
|
58
|
-
}, (0, _utils.formatNumber)(
|
|
59
|
-
colorTheme:
|
|
62
|
+
}, (0, _utils.formatNumber)(leftData.value)), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
63
|
+
colorTheme: leftColor,
|
|
60
64
|
variant: "subtitle2"
|
|
61
65
|
}, unit)), /*#__PURE__*/_react.default.createElement("div", {
|
|
62
66
|
className: _stylesModule.default.valueGroup
|
|
63
67
|
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
68
|
+
colorTheme: rightColor,
|
|
64
69
|
variant: "title1"
|
|
65
|
-
}, (0, _utils.formatNumber)(
|
|
70
|
+
}, (0, _utils.formatNumber)(rightData.value)), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
71
|
+
colorTheme: rightColor,
|
|
66
72
|
variant: "subtitle2"
|
|
67
73
|
}, unit))), /*#__PURE__*/_react.default.createElement("div", {
|
|
68
74
|
className: _stylesModule.default.rowSpaceBetween
|
|
69
|
-
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, null,
|
|
75
|
+
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, null, leftData.label), /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, null, rightData.label))))), isExceeded && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_core.Divider, {
|
|
70
76
|
className: _stylesModule.default.divider
|
|
71
77
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
72
78
|
className: _stylesModule.default.footerSection
|