@credithub/harlan-components 1.16.1 → 1.16.2
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/lib/cjs/index.js +17206 -8
- package/lib/esm/components/chart/utils/chartUtils.js +4 -3
- package/package.json +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
2
|
import { useMemo, useContext } from "react";
|
|
3
|
-
import { encontrarDataMaisRecente,
|
|
3
|
+
import { encontrarDataMaisRecente, } from "../../../utils/calculation";
|
|
4
4
|
import { Queries, RequestStatus } from "../../../components/webservice";
|
|
5
5
|
import XPathUtils from "../../../utils/xpath";
|
|
6
|
+
import { last } from "lodash";
|
|
6
7
|
export var useCalculation = function (itens) {
|
|
7
|
-
var quantidade = useMemo(function () { return
|
|
8
|
-
var valorTotal = useMemo(function () { return
|
|
8
|
+
var quantidade = useMemo(function () { var _a; return ((_a = last(itens)) === null || _a === void 0 ? void 0 : _a.quantidade) || 0; }, [itens]);
|
|
9
|
+
var valorTotal = useMemo(function () { var _a; return ((_a = last(itens)) === null || _a === void 0 ? void 0 : _a.valorTotal) || 0; }, [itens]);
|
|
9
10
|
var dataMaisRecente = useMemo(function () { return encontrarDataMaisRecente(itens); }, [itens]);
|
|
10
11
|
return { quantidade: quantidade, valorTotal: valorTotal, dataMaisRecente: dataMaisRecente };
|
|
11
12
|
};
|