@widergy/utilitygo-smart-bill-web 1.13.4 → 2.0.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.
- package/CHANGELOG.md +21 -0
- package/dist/components/Advice/index.js +3 -14
- package/dist/components/Amount/index.js +11 -29
- package/dist/components/Amount/styles.module.scss +1 -2
- package/dist/components/Amount/utils.js +0 -3
- package/dist/components/Banner/index.js +3 -12
- package/dist/components/BarChart/index.js +12 -32
- package/dist/components/BarChart/styles.module.scss +5 -5
- package/dist/components/BarChart/utils.js +1 -6
- package/dist/components/BillCalculation/components/ConceptCard/index.js +31 -36
- package/dist/components/BillCalculation/components/Glossary/index.js +30 -50
- package/dist/components/BillCalculation/components/Glossary/styles.module.scss +0 -6
- package/dist/components/BillCalculation/index.js +13 -46
- package/dist/components/BillCalculation/utils.js +3 -15
- package/dist/components/BillSummary/components/BilledConcepts/components/Concept/index.js +11 -29
- package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/index.js +2 -15
- package/dist/components/BillSummary/components/BilledConcepts/constants.js +0 -4
- package/dist/components/BillSummary/components/BilledConcepts/index.js +11 -40
- package/dist/components/BillSummary/components/BilledConcepts/styles.module.scss +1 -1
- package/dist/components/BillSummary/components/BilledConcepts/utils.js +13 -38
- package/dist/components/BillSummary/index.js +7 -42
- package/dist/components/BillSummary/styles.module.scss +0 -4
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/DataLine/index.js +0 -8
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/index.js +5 -20
- package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/utils.js +0 -7
- package/dist/components/ConsumptionComparison/components/ComparisonTable/constants.js +18 -39
- package/dist/components/ConsumptionComparison/components/ComparisonTable/index.js +2 -16
- package/dist/components/ConsumptionComparison/components/ComparisonTable/utils.js +15 -37
- package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/index.js +8 -16
- package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/utils.js +0 -7
- package/dist/components/ConsumptionComparison/components/PercentageComparison/index.js +12 -25
- package/dist/components/ConsumptionComparison/components/PercentageComparison/styles.module.scss +0 -10
- package/dist/components/ConsumptionComparison/components/PercentageComparison/utils.js +4 -11
- package/dist/components/ConsumptionComparison/index.js +9 -44
- package/dist/components/ConsumptionComparison/styles.module.scss +0 -5
- package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/index.js +13 -38
- package/dist/components/ConsumptionEnergyDetails/components/ConsumptionInDaysLabel/index.js +9 -20
- package/dist/components/ConsumptionEnergyDetails/components/EnergyTotalConsumption/index.js +14 -26
- package/dist/components/ConsumptionEnergyDetails/components/EnergyTotalConsumption/styles.module.scss +0 -6
- package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/index.js +10 -24
- package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/utils.js +0 -6
- package/dist/components/ConsumptionEnergyDetails/index.js +14 -41
- package/dist/components/ConsumptionEnergyDetails/styles.module.scss +2 -6
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/index.js +39 -55
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/styles.module.scss +2 -8
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/utils.js +0 -3
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/index.js +7 -23
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/styles.module.scss +0 -4
- package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderSettlement/index.js +4 -15
- package/dist/components/ConsumptionIncluded/components/TimelineRow/index.js +16 -33
- package/dist/components/ConsumptionIncluded/index.js +1 -18
- package/dist/components/ConsumptionIncluded/utils.js +2 -30
- package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/components/ReadingRow/index.js +7 -19
- package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/index.js +12 -27
- package/dist/components/ConsumptionPeriod/components/HistoryGraph/index.js +6 -30
- package/dist/components/ConsumptionPeriod/components/Reading/index.js +15 -33
- package/dist/components/ConsumptionPeriod/components/Reading/styles.module.scss +0 -1
- package/dist/components/ConsumptionPeriod/index.js +1 -20
- package/dist/components/ConsumptionPeriod/utils.js +0 -6
- package/dist/components/Date/index.js +6 -17
- package/dist/components/Date/styles.module.scss +2 -4
- package/dist/components/DebtState/index.js +6 -16
- package/dist/components/DebtState/styles.module.scss +2 -11
- package/dist/components/IconAndDetails/index.js +13 -26
- package/dist/components/Magnitude/index.js +18 -39
- package/dist/components/Magnitude/utils.js +0 -29
- package/dist/components/MainBillData/components/BillAlert/components/BillParticularConditions/index.js +6 -17
- package/dist/components/MainBillData/components/BillAlert/index.js +12 -39
- package/dist/components/MainBillData/components/BillAlert/styles.module.scss +4 -1
- package/dist/components/MainBillData/components/BillBody/components/ClientData/index.js +5 -19
- package/dist/components/MainBillData/components/BillBody/components/ClientData/styles.module.scss +1 -3
- package/dist/components/MainBillData/components/BillBody/components/Consumption/index.js +4 -20
- package/dist/components/MainBillData/components/BillBody/components/Consumption/utils.js +0 -2
- package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/index.js +16 -30
- package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/utils.js +0 -5
- package/dist/components/MainBillData/components/BillBody/index.js +3 -35
- package/dist/components/MainBillData/components/BillHeader/components/TypeAndNumber/index.js +7 -19
- package/dist/components/MainBillData/components/BillHeader/index.js +4 -27
- package/dist/components/MainBillData/index.js +1 -16
- package/dist/components/MainBillData/theme.js +0 -3
- package/dist/components/MainBillData/utils.js +0 -3
- package/dist/components/Period/index.js +18 -44
- package/dist/components/Period/styles.module.scss +9 -9
- package/dist/components/PowerProgresBar/components/PowerConsumption/index.js +21 -28
- package/dist/components/PowerProgresBar/components/PowerConsumption/styles.module.scss +0 -7
- package/dist/components/PowerProgresBar/index.js +8 -29
- package/dist/components/PowerProgresBar/styles.module.scss +5 -9
- package/dist/components/RateAndCategory/index.js +8 -26
- package/dist/components/RateAndCategory/styles.module.scss +1 -4
- package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/index.js +11 -23
- package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/styles.module.scss +0 -1
- package/dist/components/RatesDefinition/components/BillRate/index.js +8 -20
- package/dist/components/RatesDefinition/components/BillRate/styles.module.scss +1 -2
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/index.js +5 -17
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/styles.module.scss +2 -4
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/components/IndicatorLabel/index.js +8 -22
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/index.js +4 -18
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/utils.js +0 -7
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Legend/index.js +4 -14
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Legend/styles.module.scss +1 -9
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/index.js +8 -16
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Stages/styles.module.scss +0 -4
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/constants.js +0 -1
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/index.js +12 -39
- package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +14 -24
- package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +11 -38
- package/dist/components/RatesDefinition/components/CategoryByConsumption/utils.js +0 -3
- package/dist/components/RatesDefinition/components/PurchasedRate/index.js +11 -23
- package/dist/components/RatesDefinition/components/PurchasedRate/styles.module.scss +5 -4
- package/dist/components/RatesDefinition/index.js +4 -25
- package/dist/components/SmartBillProvider/index.js +5 -26
- package/dist/components/StyledAmount/constants.js +0 -3
- package/dist/components/StyledAmount/index.js +18 -38
- package/dist/components/StyledAmount/styles.module.scss +2 -3
- package/dist/components/WithContextApi/index.js +4 -15
- package/dist/components/WithContextApi/layout.js +0 -9
- package/dist/components/WithSeason/index.js +0 -6
- package/dist/constants/deviceSizes.js +4 -16
- package/dist/index.js +0 -18
- package/dist/scss/variables/_colors.scss +0 -6
- package/dist/scss/variables/_colorsExport.scss +0 -6
- package/dist/shared/Context/index.js +1 -5
- package/dist/shared/constants/aliases.js +84 -82
- package/dist/shared/types/assetsTypes.js +0 -3
- package/dist/shared/types/billDataTypes.js +13 -13
- package/dist/shared/types/componentsTypes.js +4 -10
- package/dist/shared/types/formattersTypes.js +0 -2
- package/dist/shared/types/rateStagesTypes.js +0 -2
- package/dist/shared/types/smartBillTypes.js +4 -10
- package/dist/shared/types/textsTypes.js +0 -2
- package/dist/shared/utils/billCalculation.js +0 -6
- package/dist/shared/utils/consumptions.js +1 -32
- package/dist/shared/utils/context.js +0 -6
- package/dist/shared/utils/expirations.js +0 -3
- package/dist/shared/utils/periods.js +0 -15
- package/dist/shared/utils/rates.js +0 -4
- package/dist/shared/utils/readings.js +0 -7
- package/dist/shared/utils/season.js +0 -3
- package/dist/shared/utils/stagesGraph.js +0 -11
- package/dist/utils/hooks.js +0 -2
- package/dist/utils.js +0 -8
- package/package.json +1 -1
|
@@ -1,81 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _smartBillTypes = require("../../shared/types/smartBillTypes");
|
|
13
|
-
|
|
14
10
|
var _billDataTypes = require("../../shared/types/billDataTypes");
|
|
15
|
-
|
|
16
11
|
var _WithContextApi = _interopRequireDefault(require("../WithContextApi"));
|
|
17
|
-
|
|
18
12
|
var _StyledAmount = _interopRequireDefault(require("../StyledAmount"));
|
|
19
|
-
|
|
20
13
|
var _aliases = require("../../shared/constants/aliases");
|
|
21
|
-
|
|
22
14
|
var _hooks = require("../../utils/hooks");
|
|
23
|
-
|
|
24
15
|
var _utils = require("./utils");
|
|
25
|
-
|
|
26
16
|
var _ConceptCard = _interopRequireDefault(require("./components/ConceptCard"));
|
|
27
|
-
|
|
28
17
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
29
|
-
|
|
30
18
|
var _Glossary = _interopRequireDefault(require("./components/Glossary"));
|
|
31
|
-
|
|
32
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
-
|
|
34
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
|
-
|
|
36
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
-
|
|
38
22
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
39
|
-
|
|
40
23
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
41
|
-
|
|
42
24
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
43
|
-
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
47
|
-
|
|
25
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
26
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
48
27
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
|
-
|
|
50
28
|
var BillCalculation = function BillCalculation(_ref) {
|
|
51
29
|
var billData = _ref.billData,
|
|
52
|
-
|
|
30
|
+
contextApiInfo = _ref.contextApiInfo;
|
|
53
31
|
var Label = contextApiInfo.Label,
|
|
54
|
-
|
|
32
|
+
config = contextApiInfo.config;
|
|
55
33
|
var texts = config.texts,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
34
|
+
showZeroConcepts = config.showZeroConcepts,
|
|
35
|
+
stylesConfig = config.stylesConfig,
|
|
36
|
+
formatters = config.formatters,
|
|
37
|
+
colors = config.colors;
|
|
60
38
|
var periodFormatter = formatters.periodFormatter;
|
|
61
39
|
var withBillCalcTitleDate = config.validations.withBillCalcTitleDate;
|
|
62
40
|
var detail = billData.detail;
|
|
63
|
-
|
|
64
41
|
var _useState = (0, _react.useState)(null),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
+
openedConcept = _useState2[0],
|
|
44
|
+
setOpenedConcept = _useState2[1];
|
|
69
45
|
var _useScreenSize = (0, _hooks.useScreenSize)(),
|
|
70
|
-
|
|
71
|
-
|
|
46
|
+
isDesktopSize = _useScreenSize.isDesktopSize;
|
|
72
47
|
var handleClick = function handleClick(index) {
|
|
73
48
|
return setOpenedConcept(openedConcept !== index ? index : null);
|
|
74
49
|
};
|
|
75
|
-
|
|
76
50
|
var glossaryConcepts = (0, _utils.filterGlossaryConcepts)(detail.concepts, showZeroConcepts);
|
|
77
51
|
var title = (0, _utils.periodToTitleMapper)(billData, texts, periodFormatter, withBillCalcTitleDate(billData));
|
|
78
|
-
|
|
79
52
|
var handleRenderConceptCard = function handleRenderConceptCard(concept, index) {
|
|
80
53
|
return (0, _utils.shouldShowConcept)(concept, showZeroConcepts) && /*#__PURE__*/_react.default.createElement(_ConceptCard.default, {
|
|
81
54
|
titleHeader: concept.title,
|
|
@@ -87,7 +60,6 @@ var BillCalculation = function BillCalculation(_ref) {
|
|
|
87
60
|
key: concept.title
|
|
88
61
|
});
|
|
89
62
|
};
|
|
90
|
-
|
|
91
63
|
var GlossaryRenderer = function GlossaryRenderer() {
|
|
92
64
|
return glossaryConcepts.length > 0 && /*#__PURE__*/_react.default.createElement(_Glossary.default, {
|
|
93
65
|
glossaryConcepts: glossaryConcepts,
|
|
@@ -95,14 +67,12 @@ var BillCalculation = function BillCalculation(_ref) {
|
|
|
95
67
|
showZeroConcepts: showZeroConcepts
|
|
96
68
|
});
|
|
97
69
|
};
|
|
98
|
-
|
|
99
70
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
100
71
|
className: _stylesModule.default.container
|
|
101
72
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
102
73
|
className: _stylesModule.default.headerSection
|
|
103
74
|
}, /*#__PURE__*/_react.default.createElement(Label, {
|
|
104
|
-
alias: _aliases.BILL_CALC_CONCEPT_TITLE
|
|
105
|
-
className: _stylesModule.default.title
|
|
75
|
+
alias: _aliases.BILL_CALC_CONCEPT_TITLE
|
|
106
76
|
}, title), isDesktopSize && /*#__PURE__*/_react.default.createElement(GlossaryRenderer, null)), detail.concepts.map(handleRenderConceptCard), /*#__PURE__*/_react.default.createElement("div", {
|
|
107
77
|
className: "".concat(_stylesModule.default.totalAmountContainer, " ").concat(stylesConfig === null || stylesConfig === void 0 ? void 0 : stylesConfig.paymentTotal),
|
|
108
78
|
style: {
|
|
@@ -117,12 +87,9 @@ var BillCalculation = function BillCalculation(_ref) {
|
|
|
117
87
|
amount: detail.total_amount
|
|
118
88
|
})), !isDesktopSize && /*#__PURE__*/_react.default.createElement(GlossaryRenderer, null));
|
|
119
89
|
};
|
|
120
|
-
|
|
121
90
|
BillCalculation.propTypes = {
|
|
122
91
|
billData: _billDataTypes.billDataTypes,
|
|
123
92
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes
|
|
124
93
|
};
|
|
125
|
-
|
|
126
94
|
var _default = (0, _WithContextApi.default)()(BillCalculation);
|
|
127
|
-
|
|
128
95
|
exports.default = _default;
|
|
@@ -4,20 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.shouldShowConcept = exports.periodToTitleMapper = exports.filterGlossaryConcepts = void 0;
|
|
7
|
-
|
|
8
7
|
var _string = require("@widergy/web-utils/lib/string");
|
|
9
|
-
|
|
10
8
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
11
|
-
|
|
12
9
|
var _periodicities = require("../../shared/constants/periodicities");
|
|
13
|
-
|
|
14
10
|
var _periods = require("../../shared/utils/periods");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
var periodToTitleMapper = function periodToTitleMapper(billData, texts, periodFormatter, withBillCalcTitleDate) {
|
|
19
13
|
var _settlements$current, _settlements$current2;
|
|
20
|
-
|
|
21
14
|
var currentPeriod = (0, _periods.getCurrentPeriod)(billData) || {};
|
|
22
15
|
var settlements = currentPeriod.settlements;
|
|
23
16
|
var periodicity = settlements === null || settlements === void 0 ? void 0 : settlements.periodicity;
|
|
@@ -26,9 +19,9 @@ var periodToTitleMapper = function periodToTitleMapper(billData, texts, periodFo
|
|
|
26
19
|
var periodNumber = (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.number) || '-';
|
|
27
20
|
var year = (currentPeriod === null || currentPeriod === void 0 ? void 0 : currentPeriod.year) || '-';
|
|
28
21
|
var _texts$commons = texts.commons,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
settlement = _texts$commons.settlement,
|
|
23
|
+
period = _texts$commons.period,
|
|
24
|
+
bimester = _texts$commons.bimester;
|
|
32
25
|
var issueedDate = settlements === null || settlements === void 0 ? void 0 : (_settlements$current2 = settlements.current) === null || _settlements$current2 === void 0 ? void 0 : _settlements$current2.issued_on;
|
|
33
26
|
var issuedDateLabel = withBillCalcTitleDate ? " (".concat((0, _dayjs.default)(issueedDate, 'YYYY-MM-DD').format('MM/YYYY'), ")") : '';
|
|
34
27
|
if (periodFormatter) return periodFormatter({
|
|
@@ -39,19 +32,14 @@ var periodToTitleMapper = function periodToTitleMapper(billData, texts, periodFo
|
|
|
39
32
|
if ((0, _string.stringToCompareWithoutAccentsInclusive)(periodicity, _periodicities.PERIODICITY.BIMONTHLY)) return "".concat(settlement, " ").concat(currentSettlement, " ").concat(texts.commons.ofPreposition, " ").concat(totalSettlements, " - ").concat(bimester, " ").concat(periodNumber).concat(issuedDateLabel);
|
|
40
33
|
return '-';
|
|
41
34
|
};
|
|
42
|
-
|
|
43
35
|
exports.periodToTitleMapper = periodToTitleMapper;
|
|
44
|
-
|
|
45
36
|
var shouldShowConcept = function shouldShowConcept(concept, showZeroConcepts) {
|
|
46
37
|
return concept.total !== 0 || showZeroConcepts;
|
|
47
38
|
};
|
|
48
|
-
|
|
49
39
|
exports.shouldShowConcept = shouldShowConcept;
|
|
50
|
-
|
|
51
40
|
var filterGlossaryConcepts = function filterGlossaryConcepts(concepts, showZeroConcepts) {
|
|
52
41
|
return concepts.filter(function (concept) {
|
|
53
42
|
return concept.description && shouldShowConcept(concept, showZeroConcepts);
|
|
54
43
|
});
|
|
55
44
|
};
|
|
56
|
-
|
|
57
45
|
exports.filterGlossaryConcepts = filterGlossaryConcepts;
|
|
@@ -4,53 +4,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = require("prop-types");
|
|
11
|
-
|
|
12
9
|
var _numeral = _interopRequireDefault(require("config/numeral"));
|
|
13
|
-
|
|
14
10
|
var _smartBillTypes = require("../../../../../../shared/types/smartBillTypes");
|
|
15
|
-
|
|
16
11
|
var _WithContextApi = _interopRequireDefault(require("../../../../../WithContextApi"));
|
|
17
|
-
|
|
18
12
|
var _StyledAmount = _interopRequireDefault(require("../../../../../StyledAmount"));
|
|
19
|
-
|
|
20
13
|
var _hooks = require("../../../../../../utils/hooks");
|
|
21
|
-
|
|
22
14
|
var _aliases = require("../../../../../../shared/constants/aliases");
|
|
23
|
-
|
|
24
15
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
25
|
-
|
|
26
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
|
|
28
17
|
var Concept = function Concept(_ref) {
|
|
29
18
|
var contextApiInfo = _ref.contextApiInfo,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
19
|
+
isFirst = _ref.isFirst,
|
|
20
|
+
title = _ref.title,
|
|
21
|
+
percentage = _ref.percentage,
|
|
22
|
+
progressBarPercentage = _ref.progressBarPercentage,
|
|
23
|
+
value = _ref.value,
|
|
24
|
+
showPercentage = _ref.showPercentage,
|
|
25
|
+
negativeAmmount = _ref.negativeAmmount,
|
|
26
|
+
showProgressBar = _ref.showProgressBar,
|
|
27
|
+
color = _ref.color;
|
|
39
28
|
var Label = contextApiInfo.Label,
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
ProgressBar = contextApiInfo.ProgressBar;
|
|
42
30
|
var _useScreenSize = (0, _hooks.useScreenSize)(),
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
isDesktopSize = _useScreenSize.isDesktopSize;
|
|
45
32
|
var alias = isFirst ? _aliases.CONCEPT_FIRST_AMOUNT : _aliases.CONCEPT_SECONDARY_AMOUNT;
|
|
46
33
|
var aliasDecimal = isFirst ? _aliases.CONCEPT_FIRST_AMOUNT_DECIMAL : _aliases.CONCEPT_SECONDARY_AMOUNT_DECIMAL;
|
|
47
34
|
var aliasName = isFirst ? _aliases.CONCEPT_FIRST_NAME : _aliases.CONCEPT_SECONDARY_NAME;
|
|
48
35
|
var percentageValue = "".concat((0, _numeral.default)(percentage).format('0,0.0'), "%");
|
|
49
|
-
|
|
50
36
|
var renderPercentageValidation = function renderPercentageValidation(withProgresBar) {
|
|
51
37
|
return showPercentage && percentage && (withProgresBar ? showProgressBar : !showProgressBar);
|
|
52
38
|
};
|
|
53
|
-
|
|
54
39
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
55
40
|
className: _stylesModule.default.container
|
|
56
41
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -90,7 +75,6 @@ var Concept = function Concept(_ref) {
|
|
|
90
75
|
amount: value
|
|
91
76
|
})));
|
|
92
77
|
};
|
|
93
|
-
|
|
94
78
|
Concept.propTypes = {
|
|
95
79
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes,
|
|
96
80
|
isFirst: _propTypes.bool,
|
|
@@ -103,7 +87,5 @@ Concept.propTypes = {
|
|
|
103
87
|
showProgressBar: _propTypes.bool,
|
|
104
88
|
color: _propTypes.string
|
|
105
89
|
};
|
|
106
|
-
|
|
107
90
|
var _default = (0, _WithContextApi.default)()(Concept);
|
|
108
|
-
|
|
109
91
|
exports.default = _default;
|
package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/index.js
CHANGED
|
@@ -4,29 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = require("prop-types");
|
|
11
|
-
|
|
12
9
|
var _smartBillTypes = require("../../../../../../shared/types/smartBillTypes");
|
|
13
|
-
|
|
14
10
|
var _WithContextApi = _interopRequireDefault(require("../../../../../WithContextApi"));
|
|
15
|
-
|
|
16
11
|
var _utils = require("../../utils");
|
|
17
|
-
|
|
18
12
|
var _constants = require("./constants");
|
|
19
|
-
|
|
20
13
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
15
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
|
-
|
|
26
16
|
var PieChartContainer = function PieChartContainer(_ref) {
|
|
27
17
|
var concepts = _ref.concepts,
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
additionalInfo = _ref.additionalInfo,
|
|
19
|
+
contextApiInfo = _ref.contextApiInfo;
|
|
30
20
|
var PieChart = contextApiInfo.PieChart;
|
|
31
21
|
var pieConceptsData = concepts.map(function (concept) {
|
|
32
22
|
return {
|
|
@@ -46,13 +36,10 @@ var PieChartContainer = function PieChartContainer(_ref) {
|
|
|
46
36
|
return (0, _utils.renderConcept)(concept, additionalInfo, index === 0);
|
|
47
37
|
}));
|
|
48
38
|
};
|
|
49
|
-
|
|
50
39
|
PieChartContainer.propTypes = {
|
|
51
40
|
additionalInfo: (0, _propTypes.shape)((0, _propTypes.objectOf)(_propTypes.any)),
|
|
52
41
|
concepts: (0, _propTypes.shape)((0, _propTypes.objectOf)(_propTypes.any)),
|
|
53
42
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes
|
|
54
43
|
};
|
|
55
|
-
|
|
56
44
|
var _default = (0, _WithContextApi.default)()(PieChartContainer);
|
|
57
|
-
|
|
58
45
|
exports.default = _default;
|
|
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.toggleOptions = exports.progressBar = exports.pieChart = exports.COLORS = void 0;
|
|
7
|
-
|
|
8
7
|
var _colorsExport = require("../../../../scss/variables/_colorsExport.scss");
|
|
9
|
-
|
|
10
8
|
var pieChart = 'pieChart';
|
|
11
9
|
exports.pieChart = pieChart;
|
|
12
10
|
var progressBar = 'progressBar';
|
|
13
11
|
exports.progressBar = progressBar;
|
|
14
|
-
|
|
15
12
|
var toggleOptions = function toggleOptions(assets) {
|
|
16
13
|
return [{
|
|
17
14
|
value: progressBar,
|
|
@@ -23,7 +20,6 @@ var toggleOptions = function toggleOptions(assets) {
|
|
|
23
20
|
SelectedIcon: assets.PieWhiteIcon
|
|
24
21
|
}];
|
|
25
22
|
};
|
|
26
|
-
|
|
27
23
|
exports.toggleOptions = toggleOptions;
|
|
28
24
|
var COLORS = [_colorsExport.primary, _colorsExport.darkGray, _colorsExport.pieChartGray, _colorsExport.pieChartLightGray];
|
|
29
25
|
exports.COLORS = COLORS;
|
|
@@ -1,74 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _aliases = require("../../../../shared/constants/aliases");
|
|
13
|
-
|
|
14
10
|
var _smartBillTypes = require("../../../../shared/types/smartBillTypes");
|
|
15
|
-
|
|
16
11
|
var _billDataTypes = require("../../../../shared/types/billDataTypes");
|
|
17
|
-
|
|
18
12
|
var _WithContextApi = _interopRequireDefault(require("../../../WithContextApi"));
|
|
19
|
-
|
|
20
13
|
var _constants = require("./constants");
|
|
21
|
-
|
|
22
14
|
var _PieChartContainer = _interopRequireDefault(require("./components/PieChartContainer"));
|
|
23
|
-
|
|
24
15
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
25
|
-
|
|
26
16
|
var _utils = require("./utils");
|
|
27
|
-
|
|
28
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
|
-
|
|
30
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
-
|
|
32
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
-
|
|
34
20
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
35
|
-
|
|
36
21
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
37
|
-
|
|
38
22
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
43
|
-
|
|
23
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
24
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
44
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
|
-
|
|
46
26
|
var BilledConcepts = function BilledConcepts(_ref) {
|
|
47
27
|
var _billData$detail;
|
|
48
|
-
|
|
49
28
|
var contextApiInfo = _ref.contextApiInfo,
|
|
50
|
-
|
|
29
|
+
billData = _ref.billData;
|
|
51
30
|
var config = contextApiInfo.config,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
31
|
+
Label = contextApiInfo.Label,
|
|
32
|
+
Toggle = contextApiInfo.Toggle,
|
|
33
|
+
assets = contextApiInfo.assets;
|
|
55
34
|
var showZeroConcepts = config.showZeroConcepts,
|
|
56
|
-
|
|
35
|
+
colors = config.colors;
|
|
57
36
|
var billedConceptsTitle = config.texts.billSummary.billedConceptsTitle;
|
|
58
|
-
|
|
59
37
|
var _useState = (0, _react.useState)(_constants.progressBar),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
toggleOption = _useState2[0],
|
|
40
|
+
setToggleOption = _useState2[1];
|
|
64
41
|
var handleChangeToggleOption = function handleChangeToggleOption(newOption) {
|
|
65
42
|
return setToggleOption(newOption);
|
|
66
43
|
};
|
|
67
|
-
|
|
68
44
|
var totalAmount = billData === null || billData === void 0 ? void 0 : (_billData$detail = billData.detail) === null || _billData$detail === void 0 ? void 0 : _billData$detail.total_amount;
|
|
69
45
|
var concepts = (0, _react.useMemo)(function () {
|
|
70
46
|
var _billData$detail2;
|
|
71
|
-
|
|
72
47
|
return (0, _utils.getOrderedAndColoredConcepts)(billData === null || billData === void 0 ? void 0 : (_billData$detail2 = billData.detail) === null || _billData$detail2 === void 0 ? void 0 : _billData$detail2.concepts, totalAmount, showZeroConcepts, (0, _utils.getColorsDefinition)(colors));
|
|
73
48
|
}, []);
|
|
74
49
|
var negativeAmmount = concepts.some(function (concept) {
|
|
@@ -86,8 +61,7 @@ var BilledConcepts = function BilledConcepts(_ref) {
|
|
|
86
61
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
87
62
|
className: _stylesModule.default.header
|
|
88
63
|
}, /*#__PURE__*/_react.default.createElement(Label, {
|
|
89
|
-
alias: _aliases.TITLE
|
|
90
|
-
className: _stylesModule.default.title
|
|
64
|
+
alias: _aliases.TITLE
|
|
91
65
|
}, billedConceptsTitle), !negativeAmmount && /*#__PURE__*/_react.default.createElement(Toggle, {
|
|
92
66
|
options: (0, _constants.toggleOptions)(assets),
|
|
93
67
|
selectedOption: toggleOption,
|
|
@@ -102,12 +76,9 @@ var BilledConcepts = function BilledConcepts(_ref) {
|
|
|
102
76
|
additionalInfo: additionalInfo
|
|
103
77
|
}));
|
|
104
78
|
};
|
|
105
|
-
|
|
106
79
|
BilledConcepts.propTypes = {
|
|
107
80
|
contextApiInfo: _smartBillTypes.contextApiInfoTypes,
|
|
108
81
|
billData: _billDataTypes.billDataTypes
|
|
109
82
|
};
|
|
110
|
-
|
|
111
83
|
var _default = (0, _WithContextApi.default)()(BilledConcepts);
|
|
112
|
-
|
|
113
84
|
exports.default = _default;
|
|
@@ -1,40 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.renderConcept = exports.getOrderedAndColoredConcepts = exports.getItemColor = exports.getColorsDefinition = exports.calculatePercentages = void 0;
|
|
7
|
-
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
9
|
var _constants = require("./constants");
|
|
11
|
-
|
|
12
10
|
var _Concept = _interopRequireDefault(require("./components/Concept"));
|
|
13
|
-
|
|
14
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
12
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
-
|
|
18
13
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
16
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
22
17
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
23
|
-
|
|
24
18
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
-
|
|
26
19
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
27
|
-
|
|
28
20
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
29
|
-
|
|
30
21
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
31
|
-
|
|
32
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
33
|
-
|
|
22
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
34
23
|
var roundPercentage = function roundPercentage(value) {
|
|
35
24
|
return Math.round(value * 10) / 10;
|
|
36
25
|
};
|
|
37
|
-
|
|
38
26
|
var calculatePercentages = function calculatePercentages(billConcepts, totalAmount) {
|
|
39
27
|
var indexToAdjust = billConcepts.findIndex(function (concept) {
|
|
40
28
|
return concept.total !== 0;
|
|
@@ -46,22 +34,19 @@ var calculatePercentages = function calculatePercentages(billConcepts, totalAmou
|
|
|
46
34
|
return roundPercentage(concept.total / totalAmount * 100 + (index === indexToAdjust ? adjustValue : 0));
|
|
47
35
|
});
|
|
48
36
|
};
|
|
49
|
-
|
|
50
37
|
exports.calculatePercentages = calculatePercentages;
|
|
51
|
-
|
|
52
38
|
var getProgressBarPercentage = function getProgressBarPercentage(maxPercentage, percentage) {
|
|
53
39
|
return percentage / maxPercentage * 100;
|
|
54
40
|
};
|
|
55
|
-
|
|
56
41
|
var renderConcept = function renderConcept(conceptData, additionalInfo, isFirst) {
|
|
57
42
|
var title = conceptData.title,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
43
|
+
total = conceptData.total,
|
|
44
|
+
color = conceptData.color,
|
|
45
|
+
percentage = conceptData.percentage,
|
|
46
|
+
progressBarPercentage = conceptData.progressBarPercentage;
|
|
62
47
|
var showProgressBar = additionalInfo.showProgressBar,
|
|
63
|
-
|
|
64
|
-
|
|
48
|
+
negativeAmmount = additionalInfo.negativeAmmount,
|
|
49
|
+
totalAmount = additionalInfo.totalAmount;
|
|
65
50
|
var showPercentage = !(percentage === 0);
|
|
66
51
|
return /*#__PURE__*/_react.default.createElement(_Concept.default, {
|
|
67
52
|
key: title,
|
|
@@ -77,13 +62,10 @@ var renderConcept = function renderConcept(conceptData, additionalInfo, isFirst)
|
|
|
77
62
|
color: !showProgressBar && color
|
|
78
63
|
});
|
|
79
64
|
};
|
|
80
|
-
|
|
81
65
|
exports.renderConcept = renderConcept;
|
|
82
|
-
|
|
83
66
|
var isZeroConcept = function isZeroConcept(concept) {
|
|
84
67
|
return concept.total === 0;
|
|
85
68
|
};
|
|
86
|
-
|
|
87
69
|
var getSortedData = function getSortedData(concepts, showZeroConcepts) {
|
|
88
70
|
var nonZeroConcepts = concepts === null || concepts === void 0 ? void 0 : concepts.filter(function (concept) {
|
|
89
71
|
return !isZeroConcept(concept);
|
|
@@ -94,13 +76,10 @@ var getSortedData = function getSortedData(concepts, showZeroConcepts) {
|
|
|
94
76
|
nonZeroLength: nonZeroConcepts.length
|
|
95
77
|
};
|
|
96
78
|
};
|
|
97
|
-
|
|
98
79
|
var getColorsDefinition = function getColorsDefinition(externalColors) {
|
|
99
80
|
return [externalColors.primary || _constants.COLORS.primary].concat(_toConsumableArray(_constants.COLORS.slice(1)));
|
|
100
81
|
};
|
|
101
|
-
|
|
102
82
|
exports.getColorsDefinition = getColorsDefinition;
|
|
103
|
-
|
|
104
83
|
var getItemColor = function getItemColor(index, nonZeroLength, colorsDefinition) {
|
|
105
84
|
var colorsLen = _constants.COLORS.length;
|
|
106
85
|
var colorIndex = index % colorsLen;
|
|
@@ -108,14 +87,11 @@ var getItemColor = function getItemColor(index, nonZeroLength, colorsDefinition)
|
|
|
108
87
|
var nextColorIndex = (index + 1) % colorsLen;
|
|
109
88
|
return colorsDefinition[isLastNonZero && colorsDefinition[colorIndex] === colorsDefinition[0] ? nextColorIndex : colorIndex];
|
|
110
89
|
};
|
|
111
|
-
|
|
112
90
|
exports.getItemColor = getItemColor;
|
|
113
|
-
|
|
114
91
|
var getOrderedAndColoredConcepts = function getOrderedAndColoredConcepts(concepts, totalAmount, showZeroConcepts, colorsDefinition) {
|
|
115
92
|
var _getSortedData = getSortedData(concepts, showZeroConcepts),
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
93
|
+
sortedConcepts = _getSortedData.sortedConcepts,
|
|
94
|
+
nonZeroLength = _getSortedData.nonZeroLength;
|
|
119
95
|
var percentages = calculatePercentages(sortedConcepts, totalAmount);
|
|
120
96
|
var maxPercentage = Math.max.apply(Math, _toConsumableArray(percentages));
|
|
121
97
|
return sortedConcepts.map(function (concept, index) {
|
|
@@ -126,5 +102,4 @@ var getOrderedAndColoredConcepts = function getOrderedAndColoredConcepts(concept
|
|
|
126
102
|
});
|
|
127
103
|
});
|
|
128
104
|
};
|
|
129
|
-
|
|
130
105
|
exports.getOrderedAndColoredConcepts = getOrderedAndColoredConcepts;
|