@credithub/harlan-components 1.13.8 → 1.14.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.
Files changed (159) hide show
  1. package/lib/cjs/components/chart/chartContent.d.ts +3 -4
  2. package/lib/cjs/components/chart/chartContent.js +40 -72
  3. package/lib/cjs/components/chart/chartSystem.d.ts +6 -0
  4. package/lib/cjs/components/chart/chartSystem.js +50 -0
  5. package/lib/cjs/components/chart/components/MixedChart.d.ts +7 -0
  6. package/lib/cjs/components/chart/components/MixedChart.js +55 -0
  7. package/lib/cjs/components/chart/components/PieChart.d.ts +7 -0
  8. package/lib/cjs/components/chart/components/PieChart.js +14 -0
  9. package/lib/cjs/components/chart/components/categoryProtestos.d.ts +7 -0
  10. package/lib/cjs/components/chart/components/categoryProtestos.js +22 -0
  11. package/lib/cjs/components/chart/hooks/useCategoryProtestos.d.ts +6 -0
  12. package/lib/cjs/components/chart/hooks/useCategoryProtestos.js +75 -0
  13. package/lib/cjs/components/chart/hooks/useChartData.d.ts +8 -0
  14. package/lib/cjs/components/chart/hooks/useChartData.js +61 -0
  15. package/lib/cjs/components/chart/hooks/useMixedChartData.d.ts +10 -0
  16. package/lib/cjs/components/chart/hooks/useMixedChartData.js +47 -0
  17. package/lib/cjs/components/chart/hooks/usePieChartData.d.ts +6 -0
  18. package/lib/cjs/components/chart/hooks/usePieChartData.js +93 -0
  19. package/lib/cjs/components/chart/quantityResult.js +22 -21
  20. package/lib/cjs/components/chart/types/iChart.d.ts +58 -0
  21. package/lib/cjs/components/chart/utils/chartCustomization.d.ts +7 -0
  22. package/lib/cjs/components/chart/utils/chartCustomization.js +159 -0
  23. package/lib/cjs/components/chart/utils/chartUtils.d.ts +11 -0
  24. package/lib/cjs/components/chart/utils/chartUtils.js +46 -0
  25. package/lib/cjs/components/chart/utils/dataManipulation.d.ts +10 -0
  26. package/lib/cjs/components/chart/utils/dataManipulation.js +106 -0
  27. package/lib/cjs/components/chart/utils/dataProcessing.d.ts +3 -0
  28. package/lib/cjs/components/chart/utils/dataProcessing.js +94 -0
  29. package/lib/cjs/components/common/button.js +1 -1
  30. package/lib/cjs/components/dossie/carrousel/carrousel.js +1 -1
  31. package/lib/cjs/components/dossie/companyLogo/companyLogo.js +7 -8
  32. package/lib/cjs/components/dossie/dossie.js +6 -5
  33. package/lib/cjs/components/dossie/summary/cardsAndProducts.js +2 -2
  34. package/lib/cjs/components/dossie/summary/summary.js +12 -9
  35. package/lib/cjs/components/interface/theme.d.ts +6 -0
  36. package/lib/cjs/components/interface/theme.js +6 -0
  37. package/lib/cjs/consultaSimples.js +4 -2
  38. package/lib/cjs/hooks/useWindowSize.d.ts +4 -0
  39. package/lib/cjs/hooks/useWindowSize.js +23 -0
  40. package/lib/cjs/index.d.ts +1 -1
  41. package/lib/cjs/index.js +5 -4
  42. package/lib/cjs/utils/fillMissingData.d.ts +6 -0
  43. package/lib/cjs/utils/fillMissingData.js +16 -0
  44. package/lib/cjs/utils/getUniqueDates.d.ts +5 -0
  45. package/lib/cjs/utils/getUniqueDates.js +13 -0
  46. package/lib/esm/components/chart/chartContent.d.ts +3 -4
  47. package/lib/esm/components/chart/chartContent.js +41 -50
  48. package/lib/esm/components/chart/chartSystem.d.ts +6 -0
  49. package/lib/esm/components/chart/chartSystem.js +45 -0
  50. package/lib/esm/components/chart/components/MixedChart.d.ts +7 -0
  51. package/lib/esm/components/chart/components/MixedChart.js +30 -0
  52. package/lib/esm/components/chart/components/PieChart.d.ts +7 -0
  53. package/lib/esm/components/chart/components/PieChart.js +9 -0
  54. package/lib/esm/components/chart/components/categoryProtestos.d.ts +7 -0
  55. package/lib/esm/components/chart/components/categoryProtestos.js +17 -0
  56. package/lib/esm/components/chart/hooks/useCategoryProtestos.d.ts +6 -0
  57. package/lib/esm/components/chart/hooks/useCategoryProtestos.js +71 -0
  58. package/lib/esm/components/chart/hooks/useChartData.d.ts +8 -0
  59. package/lib/esm/components/chart/hooks/useChartData.js +59 -0
  60. package/lib/esm/components/chart/hooks/useMixedChartData.d.ts +10 -0
  61. package/lib/esm/components/chart/hooks/useMixedChartData.js +43 -0
  62. package/lib/esm/components/chart/hooks/usePieChartData.d.ts +6 -0
  63. package/lib/esm/components/chart/hooks/usePieChartData.js +89 -0
  64. package/lib/esm/components/chart/quantityResult.js +23 -22
  65. package/lib/esm/components/chart/types/iChart.d.ts +58 -0
  66. package/lib/esm/components/chart/utils/chartCustomization.d.ts +7 -0
  67. package/lib/esm/components/chart/utils/chartCustomization.js +154 -0
  68. package/lib/esm/components/chart/utils/chartUtils.d.ts +11 -0
  69. package/lib/esm/components/chart/utils/chartUtils.js +37 -0
  70. package/lib/esm/components/chart/utils/dataManipulation.d.ts +10 -0
  71. package/lib/esm/components/chart/utils/dataManipulation.js +97 -0
  72. package/lib/esm/components/chart/utils/dataProcessing.d.ts +3 -0
  73. package/lib/esm/components/chart/utils/dataProcessing.js +86 -0
  74. package/lib/esm/components/common/button.js +1 -1
  75. package/lib/esm/components/dossie/carrousel/carrousel.js +1 -1
  76. package/lib/esm/components/dossie/companyLogo/companyLogo.js +7 -8
  77. package/lib/esm/components/dossie/dossie.js +6 -5
  78. package/lib/esm/components/dossie/summary/cardsAndProducts.js +2 -2
  79. package/lib/esm/components/dossie/summary/summary.js +12 -9
  80. package/lib/esm/components/interface/theme.d.ts +6 -0
  81. package/lib/esm/components/interface/theme.js +6 -0
  82. package/lib/esm/consultaSimples.js +6 -4
  83. package/lib/esm/hooks/useWindowSize.d.ts +4 -0
  84. package/lib/esm/hooks/useWindowSize.js +19 -0
  85. package/lib/esm/index.d.ts +1 -1
  86. package/lib/esm/index.js +4 -1
  87. package/lib/esm/utils/fillMissingData.d.ts +6 -0
  88. package/lib/esm/utils/fillMissingData.js +12 -0
  89. package/lib/esm/utils/getUniqueDates.d.ts +5 -0
  90. package/lib/esm/utils/getUniqueDates.js +9 -0
  91. package/package.json +8 -1
  92. package/lib/cjs/components/chart/categoryProtestos.d.ts +0 -4
  93. package/lib/cjs/components/chart/categoryProtestos.js +0 -97
  94. package/lib/cjs/components/chart/chartHelper.d.ts +0 -7
  95. package/lib/cjs/components/chart/chartHelper.js +0 -66
  96. package/lib/cjs/components/chart/customChart.d.ts +0 -10
  97. package/lib/cjs/components/chart/customChart.js +0 -142
  98. package/lib/cjs/components/chart/getUniqueDates.d.ts +0 -2
  99. package/lib/cjs/components/chart/getUniqueDates.js +0 -8
  100. package/lib/cjs/components/chart/plotly/barChartDataStrategy.d.ts +0 -14
  101. package/lib/cjs/components/chart/plotly/barChartDataStrategy.js +0 -152
  102. package/lib/cjs/components/chart/plotly/baseChartDataStrategy.d.ts +0 -8
  103. package/lib/cjs/components/chart/plotly/baseChartDataStrategy.js +0 -31
  104. package/lib/cjs/components/chart/plotly/getSeries.d.ts +0 -3
  105. package/lib/cjs/components/chart/plotly/getSeries.js +0 -35
  106. package/lib/cjs/components/chart/plotly/iChartDataStrategy.d.ts +0 -35
  107. package/lib/cjs/components/chart/plotly/index.d.ts +0 -5
  108. package/lib/cjs/components/chart/plotly/index.js +0 -20
  109. package/lib/cjs/components/chart/plotly/layoutLineBarChart.d.ts +0 -39
  110. package/lib/cjs/components/chart/plotly/layoutLineBarChart.js +0 -67
  111. package/lib/cjs/components/chart/plotly/lineChartDataStrategy.d.ts +0 -17
  112. package/lib/cjs/components/chart/plotly/lineChartDataStrategy.js +0 -198
  113. package/lib/cjs/components/chart/plotly/pieChartDataStrategy.d.ts +0 -5
  114. package/lib/cjs/components/chart/plotly/pieChartDataStrategy.js +0 -45
  115. package/lib/cjs/components/chart/plotly/types.d.ts +0 -40
  116. package/lib/cjs/components/chart/plotly/types.js +0 -2
  117. package/lib/cjs/components/chart/processChartData.d.ts +0 -5
  118. package/lib/cjs/components/chart/processChartData.js +0 -41
  119. package/lib/cjs/components/chart/useCalculation.d.ts +0 -6
  120. package/lib/cjs/components/chart/useCalculation.js +0 -12
  121. package/lib/cjs/components/chart/useDividasPublicas.d.ts +0 -5
  122. package/lib/cjs/components/chart/useDividasPublicas.js +0 -26
  123. package/lib/cjs/components/chart/useUltimaOcorrenciaCCF.d.ts +0 -2
  124. package/lib/cjs/components/chart/useUltimaOcorrenciaCCF.js +0 -20
  125. package/lib/esm/components/chart/categoryProtestos.d.ts +0 -4
  126. package/lib/esm/components/chart/categoryProtestos.js +0 -69
  127. package/lib/esm/components/chart/chartHelper.d.ts +0 -7
  128. package/lib/esm/components/chart/chartHelper.js +0 -60
  129. package/lib/esm/components/chart/customChart.d.ts +0 -10
  130. package/lib/esm/components/chart/customChart.js +0 -112
  131. package/lib/esm/components/chart/getUniqueDates.d.ts +0 -2
  132. package/lib/esm/components/chart/getUniqueDates.js +0 -4
  133. package/lib/esm/components/chart/plotly/barChartDataStrategy.d.ts +0 -14
  134. package/lib/esm/components/chart/plotly/barChartDataStrategy.js +0 -149
  135. package/lib/esm/components/chart/plotly/baseChartDataStrategy.d.ts +0 -8
  136. package/lib/esm/components/chart/plotly/baseChartDataStrategy.js +0 -28
  137. package/lib/esm/components/chart/plotly/getSeries.d.ts +0 -3
  138. package/lib/esm/components/chart/plotly/getSeries.js +0 -31
  139. package/lib/esm/components/chart/plotly/iChartDataStrategy.d.ts +0 -35
  140. package/lib/esm/components/chart/plotly/index.d.ts +0 -5
  141. package/lib/esm/components/chart/plotly/index.js +0 -5
  142. package/lib/esm/components/chart/plotly/layoutLineBarChart.d.ts +0 -39
  143. package/lib/esm/components/chart/plotly/layoutLineBarChart.js +0 -64
  144. package/lib/esm/components/chart/plotly/lineChartDataStrategy.d.ts +0 -17
  145. package/lib/esm/components/chart/plotly/lineChartDataStrategy.js +0 -195
  146. package/lib/esm/components/chart/plotly/pieChartDataStrategy.d.ts +0 -5
  147. package/lib/esm/components/chart/plotly/pieChartDataStrategy.js +0 -42
  148. package/lib/esm/components/chart/plotly/types.d.ts +0 -40
  149. package/lib/esm/components/chart/plotly/types.js +0 -1
  150. package/lib/esm/components/chart/processChartData.d.ts +0 -5
  151. package/lib/esm/components/chart/processChartData.js +0 -37
  152. package/lib/esm/components/chart/useCalculation.d.ts +0 -6
  153. package/lib/esm/components/chart/useCalculation.js +0 -8
  154. package/lib/esm/components/chart/useDividasPublicas.d.ts +0 -5
  155. package/lib/esm/components/chart/useDividasPublicas.js +0 -21
  156. package/lib/esm/components/chart/useUltimaOcorrenciaCCF.d.ts +0 -2
  157. package/lib/esm/components/chart/useUltimaOcorrenciaCCF.js +0 -15
  158. /package/lib/cjs/components/chart/{plotly/iChartDataStrategy.js → types/iChart.js} +0 -0
  159. /package/lib/esm/components/chart/{plotly/iChartDataStrategy.js → types/iChart.js} +0 -0
@@ -1,7 +1,6 @@
1
1
  import React from "react";
2
- import { DataInput } from "./plotly/types";
3
- interface ChartContentProps {
2
+ import { DataInput } from "./types/iChart";
3
+ declare const ChartContent: React.FC<{
4
4
  dataInput: DataInput;
5
- }
6
- declare const ChartContent: React.FC<ChartContentProps>;
5
+ }>;
7
6
  export default ChartContent;
@@ -1,87 +1,55 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
12
5
  };
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
6
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
7
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
8
+ if (ar || !(i in from)) {
9
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
10
+ ar[i] = from[i];
11
+ }
18
12
  }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
13
+ return to.concat(ar || Array.prototype.slice.call(from));
35
14
  };
36
15
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
16
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
17
  };
39
18
  Object.defineProperty(exports, "__esModule", { value: true });
40
- var react_1 = __importStar(require("react"));
41
- var react_plotly_js_1 = __importDefault(require("react-plotly.js"));
42
- var chartHelper_1 = require("./chartHelper");
43
- var plotly_1 = require("./plotly");
44
- var processChartData_1 = require("./processChartData");
45
- var pieChartDataStrategy_1 = require("./plotly/pieChartDataStrategy");
46
- var getUniqueDates_1 = require("./getUniqueDates");
47
- var underscore_1 = require("underscore");
48
- var categoryProtestos_1 = __importDefault(require("./categoryProtestos"));
19
+ var react_1 = __importDefault(require("react"));
20
+ var chart_js_1 = require("chart.js");
21
+ var categoryProtestos_1 = __importDefault(require("./components/categoryProtestos"));
49
22
  var responsiveGrid_1 = __importDefault(require("../interface/responsiveGrid"));
23
+ var PieChart_1 = __importDefault(require("./components/PieChart"));
24
+ var styled_components_1 = __importDefault(require("styled-components"));
25
+ var MixedChart_1 = __importDefault(require("./components/MixedChart"));
26
+ var chartjs_plugin_datalabels_1 = __importDefault(require("chartjs-plugin-datalabels"));
27
+ var useWindowSize_1 = require("../../hooks/useWindowSize");
28
+ chart_js_1.Chart.register.apply(chart_js_1.Chart, __spreadArray([chartjs_plugin_datalabels_1.default], chart_js_1.registerables, false));
29
+ var Title = styled_components_1.default.h2(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n text-align: left;\n margin-bottom: 20px;\n"], ["\n text-align: left;\n margin-bottom: 20px;\n"])));
30
+ var getWidth = function (windowWidth, chartType) {
31
+ var baseWidth = windowWidth <= 768 ? "98%" : windowWidth <= 1200 ? "92%" : "100%";
32
+ if (chartType === "pie") {
33
+ return windowWidth <= 1001 ? "80%" : windowWidth <= 1200 ? "80%" : "100%";
34
+ }
35
+ return baseWidth;
36
+ };
37
+ var ChartContainer = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: ", ";\n"], ["\n width: ", ";\n"])), function (_a) {
38
+ var windowWidth = _a.windowWidth, chartType = _a.chartType;
39
+ return getWidth(windowWidth, chartType);
40
+ });
50
41
  var ChartContent = function (_a) {
51
- var _b;
52
42
  var dataInput = _a.dataInput;
53
- var _c = (0, react_1.useState)(window.innerWidth), windowWidth = _c[0], setWindowWidth = _c[1];
54
- // Atualiza a largura da janela
55
- var updateWindowWidth = function () {
56
- setWindowWidth(window.innerWidth);
57
- };
58
- (0, react_1.useEffect)(function () {
59
- window.addEventListener("resize", updateWindowWidth);
60
- return function () { return window.removeEventListener("resize", updateWindowWidth); };
61
- }, []);
62
- var pieChartData = (0, react_1.useMemo)(function () {
63
- var pieChartStrategy = new pieChartDataStrategy_1.PieChartDataStrategy();
64
- return (0, chartHelper_1.createPieChart)(pieChartStrategy.processData(dataInput));
65
- }, [dataInput]);
66
- var pieChartWidth = windowWidth > 1000 ? windowWidth * 0.4 : windowWidth * 0.92;
67
- var lineBarChartWidth = windowWidth > 1000 && (pieChartData === null || pieChartData === void 0 ? void 0 : pieChartData.possuiPendencias) ? windowWidth * 0.55 : windowWidth * 0.92;
68
- var dates = (0, react_1.useMemo)(function () {
69
- return (0, getUniqueDates_1.getUniqueDates)(dataInput);
70
- }, [dataInput]);
71
- var chartData = (0, react_1.useMemo)(function () {
72
- return dataInput ? (0, processChartData_1.processChartData)({ dataInput: dataInput, dates: dates }) : [];
73
- }, [dataInput, dates]);
74
- var lastDate = (0, underscore_1.max)(dates, function (x) { return x.getTime(); });
75
- var plotLayout = (0, plotly_1.layoutLineBarChart)(lineBarChartWidth, lastDate);
43
+ var windowWidth = (0, useWindowSize_1.useWindowSize)().width;
76
44
  return (react_1.default.createElement(react_1.default.Fragment, null,
77
45
  react_1.default.createElement(responsiveGrid_1.default, { desktop: "1fr 2fr" },
78
- react_1.default.createElement("div", { hidden: !pieChartData.possuiPendencias, style: { width: pieChartWidth } },
79
- react_1.default.createElement("h2", null, "Quantidade de Ocorr\u00EAncias"),
80
- react_1.default.createElement(react_plotly_js_1.default, { config: { displayModeBar: false }, data: [__assign(__assign({}, pieChartData), { values: (_b = pieChartData === null || pieChartData === void 0 ? void 0 : pieChartData.values) === null || _b === void 0 ? void 0 : _b.map(function (e) { return e === '0' ? null : e; }) })], layout: { width: pieChartWidth, paper_bgcolor: "rgba(0,0,0,0)" } })),
81
- react_1.default.createElement("div", { style: { width: lineBarChartWidth } },
82
- react_1.default.createElement("h2", null, "Quantidade de Ocorr\u00EAncias por Consulta"),
83
- react_1.default.createElement(react_plotly_js_1.default, { data: chartData, layout: plotLayout }))),
84
- react_1.default.createElement("div", null,
85
- react_1.default.createElement(categoryProtestos_1.default, { width: windowWidth * 0.9, height: 256 }))));
46
+ react_1.default.createElement(ChartContainer, { windowWidth: windowWidth, chartType: "pie" },
47
+ react_1.default.createElement(Title, null, "Resumo de Ocorr\u00EAncias"),
48
+ react_1.default.createElement(PieChart_1.default, { dataInput: dataInput })),
49
+ react_1.default.createElement(ChartContainer, { windowWidth: windowWidth, chartType: "mixed" },
50
+ react_1.default.createElement(Title, null, "Detalhamento por Categoria"),
51
+ react_1.default.createElement(MixedChart_1.default, { dataInput: dataInput }))),
52
+ react_1.default.createElement(categoryProtestos_1.default, { dataInput: dataInput.protestosCategory || [] })));
86
53
  };
87
54
  exports.default = ChartContent;
55
+ var templateObject_1, templateObject_2;
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ interface ChartSystemProps {
3
+ documento: string;
4
+ }
5
+ declare const ChartSystem: React.FC<ChartSystemProps>;
6
+ export default ChartSystem;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ var react_1 = __importDefault(require("react"));
11
+ var chartUtils_1 = require("./utils/chartUtils");
12
+ var header_1 = __importDefault(require("../interface/header"));
13
+ var statusMessage_1 = __importDefault(require("../interface/statusMessage"));
14
+ var useToggle_1 = __importDefault(require("../../hooks/useToggle"));
15
+ var styled_components_1 = __importDefault(require("styled-components"));
16
+ var quantityResult_1 = __importDefault(require("./quantityResult"));
17
+ var chartContent_1 = __importDefault(require("./chartContent"));
18
+ var btnWrapper_1 = __importDefault(require("../../assets/btn/btnWrapper"));
19
+ var chevronUp_1 = __importDefault(require("../../assets/btn/chevronUp"));
20
+ var chevronDown_1 = __importDefault(require("../../assets/btn/chevronDown"));
21
+ var useChartData_1 = __importDefault(require("./hooks/useChartData"));
22
+ var result_1 = require("../interface/result");
23
+ var resumoNegativacoes_1 = __importDefault(require("../../assets/icones/resumoNegativacoes"));
24
+ var Content = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n"], ["\n display: ", ";\n"])), function (props) { return (props.isOpen ? "block" : "none"); });
25
+ var ChartSystem = function (_a) {
26
+ var _b, _c, _d;
27
+ var documento = _a.documento;
28
+ var _e = (0, useChartData_1.default)(documento), data = _e.data, isLoading = _e.isLoading, error = _e.error;
29
+ var errorMessage = typeof error === "string" ? error : error === null || error === void 0 ? void 0 : error.toString();
30
+ var _f = (0, useToggle_1.default)(true), isOpen = _f[0], toggleOpen = _f[1];
31
+ var ultimaOcorrenciaCCF = (0, chartUtils_1.useUltimaOcorrenciaCCF)();
32
+ var quantidadeProtestos = ((_c = (_b = data === null || data === void 0 ? void 0 : data.protestos) === null || _b === void 0 ? void 0 : _b[(data === null || data === void 0 ? void 0 : data.protestos.length) - 1]) === null || _c === void 0 ? void 0 : _c.quantidade) || 0;
33
+ var valorTotalProtestos = (0, chartUtils_1.useCalculation)((data === null || data === void 0 ? void 0 : data.protestos) || []).valorTotal;
34
+ var _g = (0, chartUtils_1.useDividasPublicas)(), quantidadeDividas = _g.quantidade, valorTotalDividas = _g.valorTotal;
35
+ var _h = (0, chartUtils_1.useCalculation)((data === null || data === void 0 ? void 0 : data.serasa) || []), quantidadeSerasa = _h.quantidade, valorTotalSerasa = _h.valorTotal;
36
+ var _j = (0, chartUtils_1.useCalculation)((data === null || data === void 0 ? void 0 : data.boaVista) || []), quantidadeBoaVista = _j.quantidade, valorTotalBoaVista = _j.valorTotal;
37
+ var quantidadeCCFs = (0, chartUtils_1.useCalculation)((data === null || data === void 0 ? void 0 : data.ccfs) || []).quantidade;
38
+ var ultimaOcorrenciaProtestos = "";
39
+ if ((data === null || data === void 0 ? void 0 : data.protestos) && data.protestos.length > 0) {
40
+ ultimaOcorrenciaProtestos = new Date(data.protestos[data.protestos.length - 1].data).toLocaleDateString();
41
+ }
42
+ return (react_1.default.createElement(react_1.default.Fragment, null,
43
+ react_1.default.createElement(header_1.default, { title: "Resumo de Negativa\u00E7\u00F5es", subtitle: "Veja a quantidade de ocorr\u00EAncias conforme o documento foi consultado ao longo do tempo", description: errorMessage && (react_1.default.createElement(statusMessage_1.default, { type: "error" }, errorMessage)), variant: isLoading ? "loading" : "default", icon: resumoNegativacoes_1.default, actions: react_1.default.createElement(btnWrapper_1.default, { onClick: toggleOpen }, isOpen ? react_1.default.createElement(chevronUp_1.default, null) : react_1.default.createElement(chevronDown_1.default, null)) }),
44
+ react_1.default.createElement(result_1.Result, null,
45
+ react_1.default.createElement(Content, { isOpen: isOpen },
46
+ data && react_1.default.createElement(chartContent_1.default, { dataInput: data }),
47
+ !isLoading && (react_1.default.createElement(quantityResult_1.default, { quantidadeProtestos: quantidadeProtestos, quantidadeProcessos: (_d = data === null || data === void 0 ? void 0 : data.pieChartTotalConfig) === null || _d === void 0 ? void 0 : _d.processosJuridicos, quantidadeDividas: quantidadeDividas, quantidadeDividasSerasa: quantidadeSerasa, quantidadeDividasBoaVista: quantidadeBoaVista, quantidadeChequesSemFundos: quantidadeCCFs, ultimaOcorrenciaChequesSemFundos: ultimaOcorrenciaCCF, valorTotalDividasSerasa: valorTotalSerasa, valorTotalDividasBoaVista: valorTotalBoaVista, valorTotalProtestos: valorTotalProtestos, valorTotalDividas: valorTotalDividas, ultimaOcorrenciaProtestos: ultimaOcorrenciaProtestos }))))));
48
+ };
49
+ exports.default = ChartSystem;
50
+ var templateObject_1;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { DataInput } from "../types/iChart";
3
+ interface MixedChartProps {
4
+ dataInput: DataInput;
5
+ }
6
+ declare const MixedChart: React.FC<MixedChartProps>;
7
+ export default MixedChart;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || function (mod) {
23
+ if (mod && mod.__esModule) return mod;
24
+ var result = {};
25
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
+ __setModuleDefault(result, mod);
27
+ return result;
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ var react_1 = __importStar(require("react"));
31
+ var react_chartjs_2_1 = require("react-chartjs-2");
32
+ var useMixedChartData_1 = require("../hooks/useMixedChartData");
33
+ var styled_components_1 = __importStar(require("styled-components"));
34
+ var TimeFilterButton = styled_components_1.default.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 8px 16px;\n margin-right: 5px;\n background-color: #f0f0f0;\n border: 1px solid #ccc;\n border-radius: 8px;\n cursor: pointer;\n width: 100px;\n min-width: 100px;\n text-align: center;\n\n ", "\n\n &:hover {\n background-color: #007af2;\n color: white;\n }\n"], ["\n padding: 8px 16px;\n margin-right: 5px;\n background-color: #f0f0f0;\n border: 1px solid #ccc;\n border-radius: 8px;\n cursor: pointer;\n width: 100px;\n min-width: 100px;\n text-align: center;\n\n ", "\n\n &:hover {\n background-color: #007af2;\n color: white;\n }\n"])), function (props) {
35
+ return props.isActive && (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: #007af2;\n color: white;\n border-color: #007af2;\n "], ["\n background-color: #007af2;\n color: white;\n border-color: #007af2;\n "])));
36
+ });
37
+ var MixedChart = function (_a) {
38
+ var dataInput = _a.dataInput;
39
+ var _b = (0, react_1.useState)("1m"), timeFilter = _b[0], setTimeFilter = _b[1];
40
+ var _c = (0, useMixedChartData_1.useMixedChartData)(dataInput, timeFilter), data = _c.data, options = _c.options;
41
+ var chartType = data.datasets.some(function (dataset) { return dataset.type === "bar"; })
42
+ ? "bar"
43
+ : "line";
44
+ return (react_1.default.createElement("div", null,
45
+ react_1.default.createElement("div", null, ["all", "1y", "6m", "1m"].map(function (filter) { return (react_1.default.createElement(TimeFilterButton, { key: filter, onClick: function () { return setTimeFilter(filter); }, isActive: timeFilter === filter }, filter === "all"
46
+ ? "All"
47
+ : filter === "1y"
48
+ ? "1 Ano"
49
+ : filter === "6m"
50
+ ? "6 Meses"
51
+ : "1 Mês")); })),
52
+ react_1.default.createElement(react_chartjs_2_1.Chart, { type: chartType, data: data, options: options })));
53
+ };
54
+ exports.default = MixedChart;
55
+ var templateObject_1, templateObject_2;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { DataInput } from "../types/iChart";
3
+ interface PieChartProps {
4
+ dataInput: DataInput;
5
+ }
6
+ declare const PieChart: React.FC<PieChartProps>;
7
+ export default PieChart;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var react_1 = __importDefault(require("react"));
7
+ var react_chartjs_2_1 = require("react-chartjs-2");
8
+ var usePieChartData_1 = require("../hooks/usePieChartData");
9
+ var PieChart = function (_a) {
10
+ var dataInput = _a.dataInput;
11
+ var _b = (0, usePieChartData_1.usePieChartData)(dataInput), data = _b.data, options = _b.options;
12
+ return react_1.default.createElement(react_chartjs_2_1.Pie, { data: data, options: options });
13
+ };
14
+ exports.default = PieChart;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { DataInput } from "../types/iChart";
3
+ interface ProtestoCategory {
4
+ dataInput: DataInput["protestosCategory"];
5
+ }
6
+ declare const CategoriaProtesto: React.FC<ProtestoCategory>;
7
+ export default CategoriaProtesto;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ var react_1 = __importDefault(require("react"));
11
+ var react_chartjs_2_1 = require("react-chartjs-2");
12
+ var styled_components_1 = __importDefault(require("styled-components"));
13
+ var useCategoryProtestos_1 = require("../hooks/useCategoryProtestos");
14
+ var ChartContainer = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 400px;\n width: 100%;\n"], ["\n height: 400px;\n width: 100%;\n"])));
15
+ var CategoriaProtesto = function (_a) {
16
+ var dataInput = _a.dataInput;
17
+ var _b = (0, useCategoryProtestos_1.useCategoryProtestos)(dataInput), data = _b.data, options = _b.options;
18
+ return (react_1.default.createElement(ChartContainer, null,
19
+ react_1.default.createElement(react_chartjs_2_1.Bar, { data: data, options: options })));
20
+ };
21
+ exports.default = CategoriaProtesto;
22
+ var templateObject_1;
@@ -0,0 +1,6 @@
1
+ import { ChartData, ChartOptions } from "chart.js";
2
+ import { DataInput } from "../types/iChart";
3
+ export declare const useCategoryProtestos: (dataInput: DataInput["protestosCategory"]) => {
4
+ data: ChartData<"bar", number[], string>;
5
+ options: ChartOptions<"bar">;
6
+ };
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCategoryProtestos = void 0;
4
+ var react_1 = require("react");
5
+ var useCategoryProtestos = function (dataInput) {
6
+ var data = (0, react_1.useMemo)(function () {
7
+ var safeDataInput = dataInput || [];
8
+ var categoryCounts = {
9
+ "Protestos de Crédito": 0,
10
+ "Protestos de Impostos": 0,
11
+ "Protestos Gerais": 0,
12
+ };
13
+ safeDataInput.forEach(function (item) {
14
+ categoryCounts[item.categoria] = item.quantidade;
15
+ });
16
+ var labels = Object.keys(categoryCounts);
17
+ var dataValues = Object.values(categoryCounts);
18
+ return {
19
+ labels: labels,
20
+ datasets: [
21
+ {
22
+ data: dataValues,
23
+ backgroundColor: [
24
+ "rgba(255, 99, 132, 0.2)",
25
+ "rgba(255, 159, 64, 0.2)",
26
+ "rgba(54, 162, 235, 0.2)",
27
+ ],
28
+ borderColor: [
29
+ "rgba(255, 99, 132, 1)",
30
+ "rgba(255, 159, 64, 1)",
31
+ "rgba(54, 162, 235, 1)",
32
+ ],
33
+ borderWidth: 1,
34
+ },
35
+ ],
36
+ };
37
+ }, [dataInput]);
38
+ var options = (0, react_1.useMemo)(function () {
39
+ return {
40
+ scales: {
41
+ y: {
42
+ beginAtZero: true,
43
+ ticks: {
44
+ precision: 0,
45
+ stepSize: 1,
46
+ suggestedMin: 0,
47
+ callback: function (value) {
48
+ return Number.isInteger(value) ? value : null;
49
+ },
50
+ },
51
+ },
52
+ },
53
+ responsive: true,
54
+ maintainAspectRatio: false,
55
+ plugins: {
56
+ legend: {
57
+ display: false,
58
+ },
59
+ title: {
60
+ display: true,
61
+ text: "Quantidade de Protestos por Categoria",
62
+ font: {
63
+ size: 12,
64
+ },
65
+ padding: {
66
+ bottom: 10,
67
+ top: 20,
68
+ },
69
+ },
70
+ },
71
+ };
72
+ }, []);
73
+ return { data: data, options: options };
74
+ };
75
+ exports.useCategoryProtestos = useCategoryProtestos;
@@ -0,0 +1,8 @@
1
+ import { DataInput } from "../../../components/chart/types/iChart";
2
+ declare const useChartData: (documento: string) => {
3
+ data: DataInput | null;
4
+ isLoading: boolean;
5
+ error: string | Error | null;
6
+ refetch: () => void;
7
+ };
8
+ export default useChartData;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var react_1 = require("react");
4
+ var webservice_1 = require("../../../components/webservice");
5
+ var dataProcessing_1 = require("../utils/dataProcessing");
6
+ var useChartData = function (documento) {
7
+ var _a = (0, react_1.useState)(null), data = _a[0], setData = _a[1];
8
+ var _b = (0, react_1.useState)(null), errorState = _b[0], setErrorState = _b[1];
9
+ var _c = (0, webservice_1.useQuery)("SELECT FROM 'DOCUMENTHISTORY'.'BASICHISTORY'", {
10
+ documento: documento,
11
+ }), response = _c.response, queryError = _c.error, isLoading = _c.isLoading, refetch = _c.refetch;
12
+ var ctxProtestos = (0, react_1.useContext)(webservice_1.Queries.Protestos);
13
+ var ctxCCF = (0, react_1.useContext)(webservice_1.Queries.CCF);
14
+ var ctxProcessosJuridicos = (0, react_1.useContext)(webservice_1.Queries.ProcessosJuridicos);
15
+ var quantidadeProcessosJuridicos = (0, react_1.useMemo)(function () {
16
+ var _a;
17
+ if ((ctxProcessosJuridicos === null || ctxProcessosJuridicos === void 0 ? void 0 : ctxProcessosJuridicos.type) === webservice_1.RequestStatus.Success &&
18
+ ((_a = ctxProcessosJuridicos.document) === null || _a === void 0 ? void 0 : _a.empresa)) {
19
+ return ctxProcessosJuridicos.document.empresa.length;
20
+ }
21
+ return 0;
22
+ }, [ctxProcessosJuridicos]);
23
+ var liveQueriesIsFinish = (0, react_1.useMemo)(function () {
24
+ return [
25
+ ctxProtestos === null || ctxProtestos === void 0 ? void 0 : ctxProtestos.type,
26
+ ctxCCF === null || ctxCCF === void 0 ? void 0 : ctxCCF.type,
27
+ ctxProcessosJuridicos === null || ctxProcessosJuridicos === void 0 ? void 0 : ctxProcessosJuridicos.type,
28
+ ].every(function (status) { return status !== webservice_1.RequestStatus.Loading; });
29
+ }, [ctxProtestos, ctxCCF, ctxProcessosJuridicos]);
30
+ var dadosProtestos = (0, react_1.useMemo)(function () {
31
+ if ((ctxProtestos === null || ctxProtestos === void 0 ? void 0 : ctxProtestos.type) === webservice_1.RequestStatus.Success && ctxProtestos.data) {
32
+ return (0, dataProcessing_1.processProtestData)(ctxProtestos.document);
33
+ }
34
+ return [];
35
+ }, [ctxProtestos]);
36
+ (0, react_1.useEffect)(function () {
37
+ if (!isLoading &&
38
+ !queryError &&
39
+ (response === null || response === void 0 ? void 0 : response.document) &&
40
+ liveQueriesIsFinish) {
41
+ try {
42
+ var parsedData = JSON.parse(response.document);
43
+ parsedData.protestosCategory = dadosProtestos;
44
+ var processedData = (0, dataProcessing_1.processData)(parsedData, quantidadeProcessosJuridicos);
45
+ setData(processedData);
46
+ }
47
+ catch (e) {
48
+ console.error("Erro ao processar os dados", e);
49
+ setErrorState("Erro ao processar os dados");
50
+ }
51
+ }
52
+ }, [
53
+ isLoading,
54
+ response,
55
+ queryError,
56
+ liveQueriesIsFinish,
57
+ quantidadeProcessosJuridicos,
58
+ ]);
59
+ return { data: data, isLoading: isLoading, error: errorState || queryError, refetch: refetch };
60
+ };
61
+ exports.default = useChartData;
@@ -0,0 +1,10 @@
1
+ import { ChartData, ChartOptions } from "chart.js";
2
+ import { DataInput, TimeFilter } from "../types/iChart";
3
+ import "chartjs-adapter-date-fns";
4
+ export declare const useMixedChartData: (dataInput: DataInput, timeFilter?: TimeFilter) => {
5
+ data: ChartData<"line" | "bar", (number | {
6
+ x: string;
7
+ y: number;
8
+ })[], string>;
9
+ options: ChartOptions<"line" | "bar">;
10
+ };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMixedChartData = void 0;
4
+ var react_1 = require("react");
5
+ require("chartjs-adapter-date-fns");
6
+ var dataManipulation_1 = require("../utils/dataManipulation");
7
+ var chartCustomization_1 = require("../utils/chartCustomization");
8
+ var useMixedChartData = function (dataInput, timeFilter) {
9
+ if (timeFilter === void 0) { timeFilter = "1m"; }
10
+ return (0, react_1.useMemo)(function () {
11
+ var filteredStartDate = (0, dataManipulation_1.getFilteredStartDate)(timeFilter, dataInput);
12
+ var endDate = (0, dataManipulation_1.getEndDate)();
13
+ var fullDataStartDate = (0, dataManipulation_1.getEarliestDate)(dataInput);
14
+ var fullProcessedData = {
15
+ protestos: (0, dataManipulation_1.addMissingDateEntries)(dataInput.protestos, fullDataStartDate, endDate),
16
+ ccfs: (0, dataManipulation_1.addMissingDateEntries)(dataInput.ccfs, fullDataStartDate, endDate),
17
+ serasa: (0, dataManipulation_1.addMissingDateEntries)(dataInput.serasa, fullDataStartDate, endDate),
18
+ boaVista: (0, dataManipulation_1.addMissingDateEntries)(dataInput.boaVista, fullDataStartDate, endDate),
19
+ dividasPublicasGrafico: (0, dataManipulation_1.addMissingDateEntries)(dataInput.dividasPublicasGrafico, fullDataStartDate, endDate),
20
+ };
21
+ var processedData = {
22
+ protestos: fullProcessedData.protestos.filter(function (d) { return new Date(d.data) >= filteredStartDate; }),
23
+ ccfs: fullProcessedData.ccfs.filter(function (d) { return new Date(d.data) >= filteredStartDate; }),
24
+ serasa: fullProcessedData.serasa.filter(function (d) { return new Date(d.data) >= filteredStartDate; }),
25
+ boaVista: fullProcessedData.boaVista.filter(function (d) { return new Date(d.data) >= filteredStartDate; }),
26
+ dividasPublicasGrafico: fullProcessedData.dividasPublicasGrafico.filter(function (d) { return new Date(d.data) >= filteredStartDate; }),
27
+ };
28
+ var uniqueDates = (0, dataManipulation_1.getUniqueDates)(processedData);
29
+ var datasets = (0, chartCustomization_1.createDatasets)(processedData, uniqueDates, timeFilter);
30
+ var options = (0, chartCustomization_1.getChartOptions)(timeFilter);
31
+ if (!options.plugins) {
32
+ options.plugins = {};
33
+ }
34
+ options.plugins.datalabels = {
35
+ display: false,
36
+ };
37
+ var labels = uniqueDates;
38
+ return {
39
+ data: {
40
+ labels: labels,
41
+ datasets: datasets,
42
+ },
43
+ options: options,
44
+ };
45
+ }, [dataInput, timeFilter]);
46
+ };
47
+ exports.useMixedChartData = useMixedChartData;
@@ -0,0 +1,6 @@
1
+ import { ChartData, ChartOptions } from "chart.js";
2
+ import { DataInput } from "../types/iChart";
3
+ export declare const usePieChartData: (dataInput: DataInput) => {
4
+ data: ChartData<"pie", number[], string>;
5
+ options: ChartOptions<"pie">;
6
+ };
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePieChartData = void 0;
4
+ var react_1 = require("react");
5
+ var useWindowSize_1 = require("../../../hooks/useWindowSize");
6
+ var usePieChartData = function (dataInput) {
7
+ var width = (0, useWindowSize_1.useWindowSize)().width;
8
+ return (0, react_1.useMemo)(function () {
9
+ var _a;
10
+ var getLastValue = function (arr) { var _a; return arr.length > 0 ? (_a = arr[arr.length - 1].quantidade) !== null && _a !== void 0 ? _a : 0 : 0; };
11
+ var totalProtestos = getLastValue(dataInput.protestos);
12
+ var totalCCFs = getLastValue(dataInput.ccfs);
13
+ var totalSerasa = getLastValue(dataInput.serasa);
14
+ var totalBoaVista = getLastValue(dataInput.boaVista);
15
+ var totalDividasPublicas = getLastValue(dataInput.dividasPublicasGrafico);
16
+ var processosJuridicos = (_a = dataInput.pieChartTotalConfig) === null || _a === void 0 ? void 0 : _a.processosJuridicos;
17
+ var chartData = {
18
+ labels: [
19
+ "Protestos",
20
+ "Cheques Devolvidos",
21
+ "Pefin/Refin Serasa",
22
+ "Pefin/Refin Boa Vista",
23
+ "Dívidas Públicas",
24
+ "Processos Jurídicos",
25
+ ],
26
+ datasets: [
27
+ {
28
+ data: [
29
+ totalProtestos,
30
+ totalCCFs,
31
+ totalSerasa,
32
+ totalBoaVista,
33
+ totalDividasPublicas,
34
+ processosJuridicos !== null && processosJuridicos !== void 0 ? processosJuridicos : 0,
35
+ ],
36
+ backgroundColor: [
37
+ "#ff4081",
38
+ "#3f51b5",
39
+ "#008cf8",
40
+ "#ffc107",
41
+ "#4caf50",
42
+ "#58508d",
43
+ ],
44
+ hoverOffset: 4,
45
+ },
46
+ ],
47
+ };
48
+ var aspectRatio = width < 1000 ? 1.5 : 1;
49
+ var options = {
50
+ responsive: true,
51
+ maintainAspectRatio: true,
52
+ aspectRatio: aspectRatio,
53
+ layout: {
54
+ padding: {
55
+ top: 32,
56
+ },
57
+ },
58
+ plugins: {
59
+ legend: {
60
+ position: "right",
61
+ align: "start",
62
+ fullSize: true,
63
+ labels: {
64
+ boxWidth: 16,
65
+ padding: 16,
66
+ },
67
+ },
68
+ title: {
69
+ display: true,
70
+ text: "Quantidade de Ocorrências",
71
+ font: {
72
+ size: 12,
73
+ },
74
+ padding: {
75
+ bottom: 8,
76
+ },
77
+ },
78
+ datalabels: {
79
+ color: "#fff",
80
+ formatter: function (value) {
81
+ return value > 0 ? value.toString() : "";
82
+ },
83
+ font: {
84
+ weight: "bold",
85
+ },
86
+ textAlign: "center",
87
+ },
88
+ },
89
+ };
90
+ return { data: chartData, options: options };
91
+ }, [dataInput]);
92
+ };
93
+ exports.usePieChartData = usePieChartData;