@credithub/harlan-components 1.3.3 → 1.4.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/lib/cjs/components/ccf/ccf.js +2 -5
- package/lib/cjs/components/chart/categoryProtestos.d.ts +4 -0
- package/lib/cjs/components/chart/categoryProtestos.js +97 -0
- package/lib/cjs/components/chart/chartContent.d.ts +7 -0
- package/lib/cjs/components/chart/chartContent.js +77 -0
- package/lib/cjs/components/chart/chartHelper.d.ts +7 -0
- package/lib/cjs/components/chart/chartHelper.js +66 -0
- package/lib/cjs/components/chart/customChart.d.ts +10 -0
- package/lib/cjs/components/chart/customChart.js +125 -0
- package/lib/cjs/components/chart/getUniqueDates.d.ts +2 -0
- package/lib/cjs/components/chart/getUniqueDates.js +8 -0
- package/lib/cjs/components/chart/plotly/barChartDataStrategy.d.ts +14 -0
- package/lib/cjs/components/chart/plotly/barChartDataStrategy.js +152 -0
- package/lib/cjs/components/chart/plotly/baseChartDataStrategy.d.ts +8 -0
- package/lib/cjs/components/chart/plotly/baseChartDataStrategy.js +31 -0
- package/lib/cjs/components/chart/plotly/getSeries.d.ts +3 -0
- package/lib/cjs/components/chart/plotly/getSeries.js +35 -0
- package/lib/cjs/components/chart/plotly/iChartDataStrategy.d.ts +35 -0
- package/lib/cjs/components/chart/plotly/iChartDataStrategy.js +2 -0
- package/lib/cjs/components/chart/plotly/index.d.ts +5 -0
- package/lib/cjs/components/chart/plotly/index.js +20 -0
- package/lib/cjs/components/chart/plotly/layoutLineBarChart.d.ts +39 -0
- package/lib/cjs/components/chart/plotly/layoutLineBarChart.js +65 -0
- package/lib/cjs/components/chart/plotly/lineChartDataStrategy.d.ts +17 -0
- package/lib/cjs/components/chart/plotly/lineChartDataStrategy.js +198 -0
- package/lib/cjs/components/chart/plotly/pieChartDataStrategy.d.ts +5 -0
- package/lib/cjs/components/chart/plotly/pieChartDataStrategy.js +45 -0
- package/lib/cjs/components/chart/plotly/types.d.ts +40 -0
- package/lib/cjs/components/chart/plotly/types.js +2 -0
- package/lib/cjs/components/chart/processChartData.d.ts +5 -0
- package/lib/cjs/components/chart/processChartData.js +41 -0
- package/lib/cjs/components/chart/quantityResult.d.ts +17 -0
- package/lib/cjs/components/chart/quantityResult.js +38 -0
- package/lib/cjs/components/chart/useCalculation.d.ts +6 -0
- package/lib/cjs/components/chart/useCalculation.js +12 -0
- package/lib/cjs/components/chart/useUltimaOcorrenciaCCF.d.ts +2 -0
- package/lib/cjs/components/chart/useUltimaOcorrenciaCCF.js +20 -0
- package/lib/cjs/components/protestos/getTotalProtestos.d.ts +1 -0
- package/lib/cjs/components/protestos/getTotalProtestos.js +10 -0
- package/lib/cjs/components/protestos/protestosCategory.js +1 -1
- package/lib/cjs/components/webservice.d.ts +14 -0
- package/lib/cjs/components/webservice.js +7 -6
- package/lib/cjs/consultaSimples.js +13 -11
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +4 -1
- package/lib/cjs/mock/mockDataInput.d.ts +34 -0
- package/lib/cjs/mock/mockDataInput.js +139 -0
- package/lib/cjs/utils/calculation.d.ts +9 -0
- package/lib/cjs/utils/calculation.js +23 -0
- package/lib/cjs/utils/date.d.ts +1 -0
- package/lib/cjs/utils/date.js +10 -0
- package/lib/cjs/utils/formatter.d.ts +2 -0
- package/lib/cjs/utils/formatter.js +7 -0
- package/lib/cjs/utils/number.d.ts +3 -2
- package/lib/cjs/utils/number.js +9 -5
- package/lib/cjs/utils/string.d.ts +1 -0
- package/lib/cjs/utils/string.js +8 -3
- package/lib/esm/components/ccf/ccf.js +2 -5
- package/lib/esm/components/chart/categoryProtestos.d.ts +4 -0
- package/lib/esm/components/chart/categoryProtestos.js +69 -0
- package/lib/esm/components/chart/chartContent.d.ts +7 -0
- package/lib/esm/components/chart/chartContent.js +49 -0
- package/lib/esm/components/chart/chartHelper.d.ts +7 -0
- package/lib/esm/components/chart/chartHelper.js +60 -0
- package/lib/esm/components/chart/customChart.d.ts +10 -0
- package/lib/esm/components/chart/customChart.js +95 -0
- package/lib/esm/components/chart/getUniqueDates.d.ts +2 -0
- package/lib/esm/components/chart/getUniqueDates.js +4 -0
- package/lib/esm/components/chart/plotly/barChartDataStrategy.d.ts +14 -0
- package/lib/esm/components/chart/plotly/barChartDataStrategy.js +149 -0
- package/lib/esm/components/chart/plotly/baseChartDataStrategy.d.ts +8 -0
- package/lib/esm/components/chart/plotly/baseChartDataStrategy.js +28 -0
- package/lib/esm/components/chart/plotly/getSeries.d.ts +3 -0
- package/lib/esm/components/chart/plotly/getSeries.js +31 -0
- package/lib/esm/components/chart/plotly/iChartDataStrategy.d.ts +35 -0
- package/lib/esm/components/chart/plotly/iChartDataStrategy.js +1 -0
- package/lib/esm/components/chart/plotly/index.d.ts +5 -0
- package/lib/esm/components/chart/plotly/index.js +5 -0
- package/lib/esm/components/chart/plotly/layoutLineBarChart.d.ts +39 -0
- package/lib/esm/components/chart/plotly/layoutLineBarChart.js +62 -0
- package/lib/esm/components/chart/plotly/lineChartDataStrategy.d.ts +17 -0
- package/lib/esm/components/chart/plotly/lineChartDataStrategy.js +195 -0
- package/lib/esm/components/chart/plotly/pieChartDataStrategy.d.ts +5 -0
- package/lib/esm/components/chart/plotly/pieChartDataStrategy.js +42 -0
- package/lib/esm/components/chart/plotly/types.d.ts +40 -0
- package/lib/esm/components/chart/plotly/types.js +1 -0
- package/lib/esm/components/chart/processChartData.d.ts +5 -0
- package/lib/esm/components/chart/processChartData.js +37 -0
- package/lib/esm/components/chart/quantityResult.d.ts +17 -0
- package/lib/esm/components/chart/quantityResult.js +33 -0
- package/lib/esm/components/chart/useCalculation.d.ts +6 -0
- package/lib/esm/components/chart/useCalculation.js +8 -0
- package/lib/esm/components/chart/useUltimaOcorrenciaCCF.d.ts +2 -0
- package/lib/esm/components/chart/useUltimaOcorrenciaCCF.js +15 -0
- package/lib/esm/components/protestos/getTotalProtestos.d.ts +1 -0
- package/lib/esm/components/protestos/getTotalProtestos.js +4 -0
- package/lib/esm/components/protestos/protestosCategory.js +1 -1
- package/lib/esm/components/webservice.d.ts +14 -0
- package/lib/esm/components/webservice.js +4 -3
- package/lib/esm/consultaSimples.js +14 -12
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/mock/mockDataInput.d.ts +34 -0
- package/lib/esm/mock/mockDataInput.js +137 -0
- package/lib/esm/utils/calculation.d.ts +9 -0
- package/lib/esm/utils/calculation.js +17 -0
- package/lib/esm/utils/date.d.ts +1 -0
- package/lib/esm/utils/date.js +6 -0
- package/lib/esm/utils/formatter.d.ts +2 -0
- package/lib/esm/utils/formatter.js +5 -0
- package/lib/esm/utils/number.d.ts +3 -2
- package/lib/esm/utils/number.js +7 -4
- package/lib/esm/utils/string.d.ts +1 -0
- package/lib/esm/utils/string.js +6 -2
- package/package.json +8 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSeries = void 0;
|
|
4
|
+
var underscore_1 = require("underscore");
|
|
5
|
+
var _1 = require("./");
|
|
6
|
+
var getUniqueDates_1 = require("../getUniqueDates");
|
|
7
|
+
function getSeries(data) {
|
|
8
|
+
var strategies = [
|
|
9
|
+
new _1.lineCCF(),
|
|
10
|
+
new _1.lineProtestos(),
|
|
11
|
+
new _1.lineSerasa(),
|
|
12
|
+
new _1.lineBoaVista(),
|
|
13
|
+
new _1.lineDividasPublicas(),
|
|
14
|
+
new _1.barSerasa(),
|
|
15
|
+
new _1.barBoaVista(),
|
|
16
|
+
new _1.barProtestos(),
|
|
17
|
+
new _1.barDividasPublicas(),
|
|
18
|
+
];
|
|
19
|
+
var processedDataSets = strategies.map(function (strategy) {
|
|
20
|
+
return strategy.processData(data);
|
|
21
|
+
});
|
|
22
|
+
var dates = (0, getUniqueDates_1.getUniqueDates)(data);
|
|
23
|
+
processedDataSets.forEach(function (dataset) {
|
|
24
|
+
dataset.data = dates.map(function (date) {
|
|
25
|
+
var foundItem = (0, underscore_1.find)(dataset.data, function (d) { return (0, underscore_1.isEqual)(d.x, date); });
|
|
26
|
+
return foundItem !== null && foundItem !== void 0 ? foundItem : { x: date, y: null };
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
processedDataSets.forEach(function (dataset) {
|
|
30
|
+
dataset.data = (0, underscore_1.sortBy)(dataset.data, function (d) { return d.x.getTime(); });
|
|
31
|
+
//dataset.data = sortBy(dataset.data, (d) => new Date(d.x).getTime());
|
|
32
|
+
});
|
|
33
|
+
return processedDataSets;
|
|
34
|
+
}
|
|
35
|
+
exports.getSeries = getSeries;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ChartDataAndLayoutState } from "./types";
|
|
2
|
+
export interface ChartDataState {
|
|
3
|
+
name: string;
|
|
4
|
+
yaxis: string;
|
|
5
|
+
type: string;
|
|
6
|
+
data: {
|
|
7
|
+
x: string | Date;
|
|
8
|
+
y: number | null;
|
|
9
|
+
}[];
|
|
10
|
+
text?: string[];
|
|
11
|
+
textposition?: string;
|
|
12
|
+
values?: number[];
|
|
13
|
+
labels?: string[];
|
|
14
|
+
color?: string;
|
|
15
|
+
marker?: {
|
|
16
|
+
color: string;
|
|
17
|
+
opacity?: number;
|
|
18
|
+
line?: {
|
|
19
|
+
color: string;
|
|
20
|
+
width: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
textfont?: {
|
|
24
|
+
bgcolor?: string;
|
|
25
|
+
family: string;
|
|
26
|
+
size: number;
|
|
27
|
+
color: string;
|
|
28
|
+
};
|
|
29
|
+
mode?: string;
|
|
30
|
+
connectgaps?: boolean;
|
|
31
|
+
hovertemplate?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface IChartDataStrategy<T> {
|
|
34
|
+
processData: (data: T) => ChartDataAndLayoutState;
|
|
35
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { BaseChartDataStrategy } from "./baseChartDataStrategy";
|
|
2
|
+
export { barDividasPublicas, barProtestos, barSerasa, barBoaVista, } from "./barChartDataStrategy";
|
|
3
|
+
export { lineDividasPublicas, lineCCF, lineSerasa, lineBoaVista, lineProtestos, } from "./lineChartDataStrategy";
|
|
4
|
+
export { getSeries } from "./getSeries";
|
|
5
|
+
export { layoutLineBarChart } from "./layoutLineBarChart";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.layoutLineBarChart = exports.getSeries = exports.lineProtestos = exports.lineBoaVista = exports.lineSerasa = exports.lineCCF = exports.lineDividasPublicas = exports.barBoaVista = exports.barSerasa = exports.barProtestos = exports.barDividasPublicas = exports.BaseChartDataStrategy = void 0;
|
|
4
|
+
var baseChartDataStrategy_1 = require("./baseChartDataStrategy");
|
|
5
|
+
Object.defineProperty(exports, "BaseChartDataStrategy", { enumerable: true, get: function () { return baseChartDataStrategy_1.BaseChartDataStrategy; } });
|
|
6
|
+
var barChartDataStrategy_1 = require("./barChartDataStrategy");
|
|
7
|
+
Object.defineProperty(exports, "barDividasPublicas", { enumerable: true, get: function () { return barChartDataStrategy_1.barDividasPublicas; } });
|
|
8
|
+
Object.defineProperty(exports, "barProtestos", { enumerable: true, get: function () { return barChartDataStrategy_1.barProtestos; } });
|
|
9
|
+
Object.defineProperty(exports, "barSerasa", { enumerable: true, get: function () { return barChartDataStrategy_1.barSerasa; } });
|
|
10
|
+
Object.defineProperty(exports, "barBoaVista", { enumerable: true, get: function () { return barChartDataStrategy_1.barBoaVista; } });
|
|
11
|
+
var lineChartDataStrategy_1 = require("./lineChartDataStrategy");
|
|
12
|
+
Object.defineProperty(exports, "lineDividasPublicas", { enumerable: true, get: function () { return lineChartDataStrategy_1.lineDividasPublicas; } });
|
|
13
|
+
Object.defineProperty(exports, "lineCCF", { enumerable: true, get: function () { return lineChartDataStrategy_1.lineCCF; } });
|
|
14
|
+
Object.defineProperty(exports, "lineSerasa", { enumerable: true, get: function () { return lineChartDataStrategy_1.lineSerasa; } });
|
|
15
|
+
Object.defineProperty(exports, "lineBoaVista", { enumerable: true, get: function () { return lineChartDataStrategy_1.lineBoaVista; } });
|
|
16
|
+
Object.defineProperty(exports, "lineProtestos", { enumerable: true, get: function () { return lineChartDataStrategy_1.lineProtestos; } });
|
|
17
|
+
var getSeries_1 = require("./getSeries");
|
|
18
|
+
Object.defineProperty(exports, "getSeries", { enumerable: true, get: function () { return getSeries_1.getSeries; } });
|
|
19
|
+
var layoutLineBarChart_1 = require("./layoutLineBarChart");
|
|
20
|
+
Object.defineProperty(exports, "layoutLineBarChart", { enumerable: true, get: function () { return layoutLineBarChart_1.layoutLineBarChart; } });
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface LayoutConfig extends Partial<Plotly.Layout> {
|
|
2
|
+
xaxis?: {
|
|
3
|
+
range: [string, string];
|
|
4
|
+
domain: [number, number];
|
|
5
|
+
rangeslider: {};
|
|
6
|
+
rangeselector: {
|
|
7
|
+
buttons: Array<{
|
|
8
|
+
step: "month" | "year" | "all";
|
|
9
|
+
stepmode?: "backward" | "todate";
|
|
10
|
+
count?: number;
|
|
11
|
+
label?: string;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
yaxis2?: {
|
|
16
|
+
title: string;
|
|
17
|
+
titlefont: {
|
|
18
|
+
color: string;
|
|
19
|
+
};
|
|
20
|
+
tickfont: {
|
|
21
|
+
color: string;
|
|
22
|
+
};
|
|
23
|
+
tickformat: string;
|
|
24
|
+
};
|
|
25
|
+
yaxis?: {
|
|
26
|
+
title: string;
|
|
27
|
+
titlefont: {
|
|
28
|
+
color: string;
|
|
29
|
+
};
|
|
30
|
+
tickfont: {
|
|
31
|
+
color: string;
|
|
32
|
+
};
|
|
33
|
+
anchor: "x";
|
|
34
|
+
side: "right";
|
|
35
|
+
overlaying: "y2";
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
declare const layoutLineBarChart: (layoutWidth: number, lastDate: Date) => LayoutConfig;
|
|
39
|
+
export { layoutLineBarChart };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.layoutLineBarChart = void 0;
|
|
4
|
+
var layoutLineBarChart = function (layoutWidth, lastDate) {
|
|
5
|
+
var currentDate = lastDate;
|
|
6
|
+
var thirtyDaysAgo = new Date(currentDate.getTime() - 30 * 24 * 60 * 60 * 1000);
|
|
7
|
+
var oneDayAhead = new Date(currentDate.getTime() + 24 * 60 * 60 * 1000);
|
|
8
|
+
var formattedThirtyDaysAgo = thirtyDaysAgo.toISOString();
|
|
9
|
+
var formattedOneDayAhead = oneDayAhead.toISOString();
|
|
10
|
+
return {
|
|
11
|
+
title: "",
|
|
12
|
+
width: layoutWidth,
|
|
13
|
+
height: 800,
|
|
14
|
+
xaxis: {
|
|
15
|
+
range: [formattedThirtyDaysAgo, formattedOneDayAhead],
|
|
16
|
+
domain: [0.1, 0.92],
|
|
17
|
+
rangeslider: { visible: true },
|
|
18
|
+
rangeselector: {
|
|
19
|
+
buttons: [
|
|
20
|
+
{
|
|
21
|
+
step: "month",
|
|
22
|
+
stepmode: "backward",
|
|
23
|
+
count: 1,
|
|
24
|
+
label: "1 mês",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
step: "month",
|
|
28
|
+
stepmode: "backward",
|
|
29
|
+
count: 6,
|
|
30
|
+
label: "6 meses",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
step: "year",
|
|
34
|
+
stepmode: "backward",
|
|
35
|
+
count: 1,
|
|
36
|
+
label: "1 ano",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
step: "all",
|
|
40
|
+
label: "all",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
yaxis2: {
|
|
46
|
+
title: "Valor Total de Negativações (R$)",
|
|
47
|
+
titlefont: { color: "#1f77b4" },
|
|
48
|
+
tickfont: { color: "#1f77b4" },
|
|
49
|
+
tickformat: ",.2f",
|
|
50
|
+
},
|
|
51
|
+
yaxis: {
|
|
52
|
+
title: "Quantidade de Ocorrências por Consulta",
|
|
53
|
+
titlefont: {
|
|
54
|
+
color: "#ff7f0e",
|
|
55
|
+
},
|
|
56
|
+
tickfont: {
|
|
57
|
+
color: "#ff7f0e",
|
|
58
|
+
},
|
|
59
|
+
anchor: "x",
|
|
60
|
+
side: "right",
|
|
61
|
+
overlaying: "y2",
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
exports.layoutLineBarChart = layoutLineBarChart;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseChartDataStrategy } from "./";
|
|
2
|
+
import { ChartDataAndLayoutState, DataInput } from "./types";
|
|
3
|
+
export declare class lineDividasPublicas extends BaseChartDataStrategy<DataInput> {
|
|
4
|
+
processData(data: DataInput): ChartDataAndLayoutState;
|
|
5
|
+
}
|
|
6
|
+
export declare class lineCCF extends BaseChartDataStrategy<DataInput> {
|
|
7
|
+
processData(data: DataInput): ChartDataAndLayoutState;
|
|
8
|
+
}
|
|
9
|
+
export declare class lineSerasa extends BaseChartDataStrategy<DataInput> {
|
|
10
|
+
processData(data: DataInput): ChartDataAndLayoutState;
|
|
11
|
+
}
|
|
12
|
+
export declare class lineBoaVista extends BaseChartDataStrategy<DataInput> {
|
|
13
|
+
processData(data: DataInput): ChartDataAndLayoutState;
|
|
14
|
+
}
|
|
15
|
+
export declare class lineProtestos extends BaseChartDataStrategy<DataInput> {
|
|
16
|
+
processData(data: DataInput): ChartDataAndLayoutState;
|
|
17
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.lineProtestos = exports.lineBoaVista = exports.lineSerasa = exports.lineCCF = exports.lineDividasPublicas = void 0;
|
|
19
|
+
var _1 = require("./");
|
|
20
|
+
var layout = {};
|
|
21
|
+
var lineDividasPublicas = /** @class */ (function (_super) {
|
|
22
|
+
__extends(lineDividasPublicas, _super);
|
|
23
|
+
function lineDividasPublicas() {
|
|
24
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
25
|
+
}
|
|
26
|
+
lineDividasPublicas.prototype.processData = function (data) {
|
|
27
|
+
var dividasPublicasData = data.dividasPublicasGrafico
|
|
28
|
+
.filter(function (consulta) { return consulta.quantidade !== null; })
|
|
29
|
+
.map(function (consulta) { return ({
|
|
30
|
+
x: consulta.data,
|
|
31
|
+
y: consulta.quantidade,
|
|
32
|
+
}); });
|
|
33
|
+
var color = "#ef4b6c";
|
|
34
|
+
var dividasPublicasState = {
|
|
35
|
+
name: "Dívidas Públicas",
|
|
36
|
+
yaxis: "y",
|
|
37
|
+
marker: {
|
|
38
|
+
color: color,
|
|
39
|
+
},
|
|
40
|
+
textfont: {
|
|
41
|
+
family: "sans serif",
|
|
42
|
+
size: 12,
|
|
43
|
+
color: color,
|
|
44
|
+
},
|
|
45
|
+
type: "scatter",
|
|
46
|
+
mode: "lines+markers+text",
|
|
47
|
+
data: dividasPublicasData,
|
|
48
|
+
connectgaps: true,
|
|
49
|
+
layout: layout,
|
|
50
|
+
};
|
|
51
|
+
return dividasPublicasState;
|
|
52
|
+
};
|
|
53
|
+
return lineDividasPublicas;
|
|
54
|
+
}(_1.BaseChartDataStrategy));
|
|
55
|
+
exports.lineDividasPublicas = lineDividasPublicas;
|
|
56
|
+
var lineCCF = /** @class */ (function (_super) {
|
|
57
|
+
__extends(lineCCF, _super);
|
|
58
|
+
function lineCCF() {
|
|
59
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
60
|
+
}
|
|
61
|
+
lineCCF.prototype.processData = function (data) {
|
|
62
|
+
var ccfData = data.ccfs
|
|
63
|
+
.filter(function (consulta) { return consulta.quantidade !== null; })
|
|
64
|
+
.map(function (consulta) { return ({
|
|
65
|
+
x: consulta.data,
|
|
66
|
+
y: consulta.quantidade,
|
|
67
|
+
}); });
|
|
68
|
+
var color = "#3f51b5";
|
|
69
|
+
var ccfState = {
|
|
70
|
+
name: "Cheques sem Fundos",
|
|
71
|
+
yaxis: "y",
|
|
72
|
+
marker: {
|
|
73
|
+
color: color,
|
|
74
|
+
},
|
|
75
|
+
textfont: {
|
|
76
|
+
family: "sans serif",
|
|
77
|
+
size: 12,
|
|
78
|
+
color: color,
|
|
79
|
+
},
|
|
80
|
+
type: "scatter",
|
|
81
|
+
mode: "lines+markers+text",
|
|
82
|
+
data: ccfData,
|
|
83
|
+
connectgaps: true,
|
|
84
|
+
layout: layout,
|
|
85
|
+
};
|
|
86
|
+
return ccfState;
|
|
87
|
+
};
|
|
88
|
+
return lineCCF;
|
|
89
|
+
}(_1.BaseChartDataStrategy));
|
|
90
|
+
exports.lineCCF = lineCCF;
|
|
91
|
+
var lineSerasa = /** @class */ (function (_super) {
|
|
92
|
+
__extends(lineSerasa, _super);
|
|
93
|
+
function lineSerasa() {
|
|
94
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
95
|
+
}
|
|
96
|
+
lineSerasa.prototype.processData = function (data) {
|
|
97
|
+
var serasaData = data.serasa
|
|
98
|
+
.filter(function (consulta) { return consulta.quantidade !== null; })
|
|
99
|
+
.map(function (consulta) { return ({
|
|
100
|
+
x: consulta.creation,
|
|
101
|
+
y: consulta.quantidade,
|
|
102
|
+
}); });
|
|
103
|
+
var serasaState = {
|
|
104
|
+
name: "Pefin/Refin Serasa",
|
|
105
|
+
yaxis: "y",
|
|
106
|
+
type: "scatter",
|
|
107
|
+
marker: {
|
|
108
|
+
color: "#ffc107",
|
|
109
|
+
},
|
|
110
|
+
textfont: {
|
|
111
|
+
family: "sans serif",
|
|
112
|
+
size: 12,
|
|
113
|
+
color: "#ffc107",
|
|
114
|
+
},
|
|
115
|
+
mode: "lines+markers+text",
|
|
116
|
+
data: serasaData,
|
|
117
|
+
connectgaps: true,
|
|
118
|
+
layout: layout,
|
|
119
|
+
};
|
|
120
|
+
return serasaState;
|
|
121
|
+
};
|
|
122
|
+
return lineSerasa;
|
|
123
|
+
}(_1.BaseChartDataStrategy));
|
|
124
|
+
exports.lineSerasa = lineSerasa;
|
|
125
|
+
var lineBoaVista = /** @class */ (function (_super) {
|
|
126
|
+
__extends(lineBoaVista, _super);
|
|
127
|
+
function lineBoaVista() {
|
|
128
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
129
|
+
}
|
|
130
|
+
lineBoaVista.prototype.processData = function (data) {
|
|
131
|
+
var boaVistaData = data.boaVista
|
|
132
|
+
.filter(function (consulta) { return consulta.quantidade !== null; })
|
|
133
|
+
.map(function (consulta) { return ({
|
|
134
|
+
x: consulta.creation,
|
|
135
|
+
y: consulta.quantidade,
|
|
136
|
+
}); });
|
|
137
|
+
var color = "#4caf50";
|
|
138
|
+
var boaVistaState = {
|
|
139
|
+
name: "Pefin/Refin Boa Vista",
|
|
140
|
+
yaxis: "y",
|
|
141
|
+
type: "scatter",
|
|
142
|
+
marker: {
|
|
143
|
+
color: color,
|
|
144
|
+
},
|
|
145
|
+
textfont: {
|
|
146
|
+
family: "sans serif",
|
|
147
|
+
size: 12,
|
|
148
|
+
color: color,
|
|
149
|
+
},
|
|
150
|
+
mode: "lines+markers+text",
|
|
151
|
+
data: boaVistaData,
|
|
152
|
+
connectgaps: true,
|
|
153
|
+
layout: layout,
|
|
154
|
+
};
|
|
155
|
+
return boaVistaState;
|
|
156
|
+
};
|
|
157
|
+
return lineBoaVista;
|
|
158
|
+
}(_1.BaseChartDataStrategy));
|
|
159
|
+
exports.lineBoaVista = lineBoaVista;
|
|
160
|
+
var lineProtestos = /** @class */ (function (_super) {
|
|
161
|
+
__extends(lineProtestos, _super);
|
|
162
|
+
function lineProtestos() {
|
|
163
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
164
|
+
}
|
|
165
|
+
lineProtestos.prototype.processData = function (data) {
|
|
166
|
+
var protestosData = data.protestos
|
|
167
|
+
.filter(function (consulta) { return consulta.quantidade !== null; })
|
|
168
|
+
.map(function (consulta) { return ({
|
|
169
|
+
x: consulta.data,
|
|
170
|
+
y: consulta.quantidade,
|
|
171
|
+
}); });
|
|
172
|
+
var protestosState = {
|
|
173
|
+
name: "Protestos",
|
|
174
|
+
yaxis: "y",
|
|
175
|
+
marker: {
|
|
176
|
+
color: "red",
|
|
177
|
+
line: {
|
|
178
|
+
color: "rgb(255, 255, 255)",
|
|
179
|
+
width: 1,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
textfont: {
|
|
183
|
+
bgcolor: "#fffff",
|
|
184
|
+
family: "sans serif",
|
|
185
|
+
size: 12,
|
|
186
|
+
color: "red",
|
|
187
|
+
},
|
|
188
|
+
type: "scatter",
|
|
189
|
+
mode: "lines+markers+text",
|
|
190
|
+
data: protestosData,
|
|
191
|
+
connectgaps: true,
|
|
192
|
+
layout: layout,
|
|
193
|
+
};
|
|
194
|
+
return protestosState;
|
|
195
|
+
};
|
|
196
|
+
return lineProtestos;
|
|
197
|
+
}(_1.BaseChartDataStrategy));
|
|
198
|
+
exports.lineProtestos = lineProtestos;
|
|
@@ -0,0 +1,45 @@
|
|
|
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);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.PieChartDataStrategy = void 0;
|
|
15
|
+
var underscore_1 = require("underscore");
|
|
16
|
+
var PieChartDataStrategy = /** @class */ (function () {
|
|
17
|
+
function PieChartDataStrategy() {
|
|
18
|
+
}
|
|
19
|
+
PieChartDataStrategy.prototype.processData = function (data) {
|
|
20
|
+
var _a, _b, _c, _d, _e, _f;
|
|
21
|
+
var totalDeProtestos = (_a = (0, underscore_1.last)(data.protestos)) === null || _a === void 0 ? void 0 : _a.quantidade;
|
|
22
|
+
var chequesDevolvidos = (_b = (0, underscore_1.last)(data.ccfs)) === null || _b === void 0 ? void 0 : _b.quantidade;
|
|
23
|
+
var totalDePefinRefinSerasa = (_c = (0, underscore_1.last)(data.serasa)) === null || _c === void 0 ? void 0 : _c.quantidade;
|
|
24
|
+
var totalDePefinRefinBoaVista = (_d = (0, underscore_1.last)(data.boaVista)) === null || _d === void 0 ? void 0 : _d.quantidade;
|
|
25
|
+
var totalDeDividasPublicas = (_e = (0, underscore_1.last)(data.dividasPublicasGrafico)) === null || _e === void 0 ? void 0 : _e.quantidade;
|
|
26
|
+
var pieChartLayout = {
|
|
27
|
+
autosize: true,
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
name: "Quantidade de Ocorrências",
|
|
31
|
+
yaxis: "",
|
|
32
|
+
type: "pie",
|
|
33
|
+
data: (_f = [
|
|
34
|
+
{ x: "Protestos", y: totalDeProtestos },
|
|
35
|
+
{ x: "Cheques Devolvidos", y: chequesDevolvidos },
|
|
36
|
+
{ x: "Pefin/Refin Serasa", y: totalDePefinRefinSerasa },
|
|
37
|
+
{ x: "Pefin/Refin Boa Vista", y: totalDePefinRefinBoaVista },
|
|
38
|
+
{ x: "Divídas Públicas", y: totalDeDividasPublicas }
|
|
39
|
+
]) === null || _f === void 0 ? void 0 : _f.map(function (query) { return (__assign(__assign({}, query), { y: query.y || 0 })); }),
|
|
40
|
+
layout: pieChartLayout,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
return PieChartDataStrategy;
|
|
44
|
+
}());
|
|
45
|
+
exports.PieChartDataStrategy = PieChartDataStrategy;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ChartDataState } from "./iChartDataStrategy";
|
|
2
|
+
import { LayoutConfig } from "./layoutLineBarChart";
|
|
3
|
+
export interface Consulta {
|
|
4
|
+
data: string | Date;
|
|
5
|
+
categoria?: string;
|
|
6
|
+
quantidade: number | null;
|
|
7
|
+
creation?: string | Date;
|
|
8
|
+
valorTotal: number | null;
|
|
9
|
+
}
|
|
10
|
+
export interface DataInput {
|
|
11
|
+
ccfs: Consulta[];
|
|
12
|
+
protestos: Consulta[];
|
|
13
|
+
serasa: Consulta[];
|
|
14
|
+
boaVista: Consulta[];
|
|
15
|
+
dividasPublicas: {
|
|
16
|
+
quantidade: number;
|
|
17
|
+
valorTotal: number;
|
|
18
|
+
};
|
|
19
|
+
dividasPublicasGrafico: Consulta[];
|
|
20
|
+
pieChartTotalConfig?: {
|
|
21
|
+
protestos?: {
|
|
22
|
+
total: number | null;
|
|
23
|
+
valorTotal: number | null;
|
|
24
|
+
ultimaOcorrencia: string | null;
|
|
25
|
+
};
|
|
26
|
+
processosJuridicos?: number;
|
|
27
|
+
ccf?: {
|
|
28
|
+
total: number | null;
|
|
29
|
+
ultimaOcorrencia: string | null;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface CategoriaProtestoProps {
|
|
34
|
+
width?: number;
|
|
35
|
+
height?: number;
|
|
36
|
+
}
|
|
37
|
+
export type LineChartMode = "lines" | "markers" | "lines+markers" | "text+markers" | "text+lines" | "text+lines+markers";
|
|
38
|
+
export interface ChartDataAndLayoutState extends ChartDataState {
|
|
39
|
+
layout: LayoutConfig;
|
|
40
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.processChartData = void 0;
|
|
15
|
+
var plotly_1 = require("./plotly");
|
|
16
|
+
var chartHelper_1 = require("./chartHelper");
|
|
17
|
+
var underscore_1 = require("underscore");
|
|
18
|
+
var processChartData = function (_a) {
|
|
19
|
+
var dataInput = _a.dataInput, dates = _a.dates;
|
|
20
|
+
var chartData = [];
|
|
21
|
+
var adicionarDatasFaltantes = function (dataset) { return dates.map(function (date) { return (0, underscore_1.find)(dataset, function (consulta) { return consulta.x === date; }) || ({ x: date, y: null }); }).flat(); };
|
|
22
|
+
var ordenarDatas = function (consultas) { return (0, underscore_1.sortBy)(consultas, function (consulta) { return consulta.x.getTime(); }); };
|
|
23
|
+
if (dataInput) {
|
|
24
|
+
var processedDataSets = (0, plotly_1.getSeries)(dataInput);
|
|
25
|
+
processedDataSets = processedDataSets.map(function (dataset) { return (__assign(__assign({}, dataset), { x: ordenarDatas(adicionarDatasFaltantes(dataset.data)) })); });
|
|
26
|
+
processedDataSets.forEach(function (dataSet) {
|
|
27
|
+
var chartDataAndLayout = __assign(__assign({}, dataSet), { layout: {} });
|
|
28
|
+
if (dataSet.type === "scatter") {
|
|
29
|
+
chartData.push((0, chartHelper_1.createLineChart)(chartDataAndLayout));
|
|
30
|
+
}
|
|
31
|
+
else if (dataSet.type === "bar") {
|
|
32
|
+
chartData.push((0, chartHelper_1.createBarChart)(chartDataAndLayout));
|
|
33
|
+
}
|
|
34
|
+
else if (dataSet.type === "pie") {
|
|
35
|
+
chartData.push((0, chartHelper_1.createPieChart)(chartDataAndLayout));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return chartData;
|
|
40
|
+
};
|
|
41
|
+
exports.processChartData = processChartData;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type QuantidadeResultadosProps = Partial<{
|
|
3
|
+
quantidadeProtestos: number;
|
|
4
|
+
quantidadeProcessos: number;
|
|
5
|
+
quantidadeDividas: number;
|
|
6
|
+
quantidadeChequesSemFundos: number;
|
|
7
|
+
quantidadeDividasSerasa: number;
|
|
8
|
+
quantidadeDividasBoaVista: number;
|
|
9
|
+
valorTotalProtestos: number;
|
|
10
|
+
valorTotalDividas: number;
|
|
11
|
+
valorTotalDividasSerasa: number;
|
|
12
|
+
valorTotalDividasBoaVista: number;
|
|
13
|
+
ultimaOcorrenciaProtestos: string;
|
|
14
|
+
ultimaOcorrenciaChequesSemFundos: string;
|
|
15
|
+
}>;
|
|
16
|
+
declare const QuantidadeResultados: React.FC<QuantidadeResultadosProps>;
|
|
17
|
+
export default QuantidadeResultados;
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
/* eslint-disable no-extra-boolean-cast */
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
9
|
+
var addItem_1 = __importDefault(require("../common/addItem"));
|
|
10
|
+
var number_1 = require("../../utils/number");
|
|
11
|
+
var QuantityContainer = function (_a) {
|
|
12
|
+
var children = _a.children;
|
|
13
|
+
return react_1.default.createElement("div", { className: (0, classnames_1.default)('container', 'field-container') }, children);
|
|
14
|
+
};
|
|
15
|
+
var QuantidadeResultados = function (_a) {
|
|
16
|
+
var _b = _a.quantidadeProtestos, quantidadeProtestos = _b === void 0 ? 0 : _b, _c = _a.quantidadeProcessos, quantidadeProcessos = _c === void 0 ? 0 : _c, _d = _a.quantidadeDividas, quantidadeDividas = _d === void 0 ? 0 : _d, _e = _a.quantidadeChequesSemFundos, quantidadeChequesSemFundos = _e === void 0 ? 0 : _e, _f = _a.quantidadeDividasSerasa, quantidadeDividasSerasa = _f === void 0 ? 0 : _f, _g = _a.quantidadeDividasBoaVista, quantidadeDividasBoaVista = _g === void 0 ? 0 : _g, _h = _a.valorTotalProtestos, valorTotalProtestos = _h === void 0 ? 0 : _h, _j = _a.valorTotalDividas, valorTotalDividas = _j === void 0 ? 0 : _j, _k = _a.valorTotalDividasSerasa, valorTotalDividasSerasa = _k === void 0 ? 0 : _k, _l = _a.valorTotalDividasBoaVista, valorTotalDividasBoaVista = _l === void 0 ? 0 : _l, _m = _a.ultimaOcorrenciaProtestos, ultimaOcorrenciaProtestos = _m === void 0 ? null : _m, _o = _a.ultimaOcorrenciaChequesSemFundos, ultimaOcorrenciaChequesSemFundos = _o === void 0 ? null : _o;
|
|
17
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
18
|
+
react_1.default.createElement("div", { className: (0, classnames_1.default)('resumo-de-negativacoes-quantity') },
|
|
19
|
+
react_1.default.createElement(QuantityContainer, null,
|
|
20
|
+
react_1.default.createElement(addItem_1.default, { name: "Total Protestos", value: (0, number_1.formatValue)(quantidadeProtestos), className: (0, classnames_1.default)("field-result") }),
|
|
21
|
+
react_1.default.createElement(addItem_1.default, { name: "Valor Total Protestos", value: (0, number_1.formatMoney)(valorTotalProtestos), className: (0, classnames_1.default)("field-result") }),
|
|
22
|
+
react_1.default.createElement(addItem_1.default, { hidden: quantidadeProtestos == 0, name: "\u00DAltima Ocorr\u00EAncia", value: ultimaOcorrenciaProtestos, className: (0, classnames_1.default)("field-result") })),
|
|
23
|
+
react_1.default.createElement(QuantityContainer, null,
|
|
24
|
+
react_1.default.createElement(addItem_1.default, { name: "Cheques Sem Fundos", value: (0, number_1.formatValue)(quantidadeChequesSemFundos), className: (0, classnames_1.default)("field-result") }),
|
|
25
|
+
react_1.default.createElement(addItem_1.default, { hidden: quantidadeChequesSemFundos == 0, name: "\u00DAltima Ocorr\u00EAncia", value: ultimaOcorrenciaChequesSemFundos, className: (0, classnames_1.default)("field-result") })),
|
|
26
|
+
react_1.default.createElement(QuantityContainer, null,
|
|
27
|
+
react_1.default.createElement(addItem_1.default, { name: "Processos Jur\u00EDdicos", value: (0, number_1.formatValue)(quantidadeProcessos), className: (0, classnames_1.default)("field-result") })),
|
|
28
|
+
react_1.default.createElement(QuantityContainer, null,
|
|
29
|
+
react_1.default.createElement(addItem_1.default, { name: "D\u00EDvidas P\u00FAblicas", value: (0, number_1.formatValue)(quantidadeDividas), className: (0, classnames_1.default)("field-result") }),
|
|
30
|
+
react_1.default.createElement(addItem_1.default, { name: "Total D\u00EDvidas P\u00FAblicas", value: (0, number_1.formatMoney)(valorTotalDividas), className: (0, classnames_1.default)("field-result") })),
|
|
31
|
+
react_1.default.createElement(QuantityContainer, null,
|
|
32
|
+
react_1.default.createElement(addItem_1.default, { name: "Pefin Refin Serasa", value: (0, number_1.formatValue)(quantidadeDividasSerasa), className: (0, classnames_1.default)("field-result") }),
|
|
33
|
+
react_1.default.createElement(addItem_1.default, { name: "Total Pefin Refin Serasa", value: (0, number_1.formatMoney)(valorTotalDividasSerasa), className: (0, classnames_1.default)("field-result") })),
|
|
34
|
+
react_1.default.createElement(QuantityContainer, null,
|
|
35
|
+
react_1.default.createElement(addItem_1.default, { name: "Pefin Refin Boa Vista", value: (0, number_1.formatValue)(quantidadeDividasBoaVista), className: (0, classnames_1.default)("field-result") }),
|
|
36
|
+
react_1.default.createElement(addItem_1.default, { name: "Total Pefin Refin Boa Vista", value: (0, number_1.formatMoney)(valorTotalDividasBoaVista), className: (0, classnames_1.default)("field-result") })))));
|
|
37
|
+
};
|
|
38
|
+
exports.default = QuantidadeResultados;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCalculation = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var calculation_1 = require("../../utils/calculation");
|
|
6
|
+
var useCalculation = function (itens) {
|
|
7
|
+
var quantidade = (0, react_1.useMemo)(function () { return (0, calculation_1.somarQuantidades)(itens); }, [itens]);
|
|
8
|
+
var valorTotal = (0, react_1.useMemo)(function () { return (0, calculation_1.somarValoresTotais)(itens); }, [itens]);
|
|
9
|
+
var dataMaisRecente = (0, react_1.useMemo)(function () { return (0, calculation_1.encontrarDataMaisRecente)(itens); }, [itens]);
|
|
10
|
+
return { quantidade: quantidade, valorTotal: valorTotal, dataMaisRecente: dataMaisRecente };
|
|
11
|
+
};
|
|
12
|
+
exports.useCalculation = useCalculation;
|