argous 1.2.174 → 1.2.176

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.
@@ -62,6 +62,6 @@ export function getFileFromLink({ URL: link }?: {
62
62
  }): Promise<string>;
63
63
  export function getLink(idDocumento: any, nrRevisao: any, timeout: any): Promise<any>;
64
64
  export function scanDocument(idDocumento: any, nrRevisao: any): Promise<any>;
65
- export function getWidgets(tpSelecao: any): Promise<any>;
65
+ export function getWidgets(tpSelecao: any, abortController: any): Promise<any>;
66
66
  export function getWidgetInfo(pgCode: any): Promise<any>;
67
67
  export function sendWidgets(widgets: any): Promise<any>;
package/dist/api/index.js CHANGED
@@ -792,14 +792,15 @@ var scanDocument = function (idDocumento, nrRevisao) { return __awaiter(void 0,
792
792
  });
793
793
  }); };
794
794
  exports.scanDocument = scanDocument;
795
- var getWidgets = function (tpSelecao) { return __awaiter(void 0, void 0, void 0, function () {
795
+ var getWidgets = function (tpSelecao, abortController) { return __awaiter(void 0, void 0, void 0, function () {
796
796
  var res;
797
797
  return __generator(this, function (_a) {
798
798
  switch (_a.label) {
799
799
  case 0: return [4 /*yield*/, fetch(exports.api() + "agetwidgets.rslvr", {
800
800
  method: 'post',
801
801
  headers: exports.headers(),
802
- body: JSON.stringify({ tpSelecao: tpSelecao })
802
+ body: JSON.stringify({ tpSelecao: tpSelecao }),
803
+ signal: abortController === null || abortController === void 0 ? void 0 : abortController.signal
803
804
  })];
804
805
  case 1:
805
806
  res = _a.sent();
@@ -0,0 +1,42 @@
1
+ export interface PercentageDisplayProps {
2
+ /**
3
+ * Identificação do elemento
4
+ */
5
+ id?: string,
6
+ /**
7
+ * Porcentagem
8
+ */
9
+ percentage?: number|string,
10
+ /**
11
+ * Tamanho do componente
12
+ */
13
+ size?: number,
14
+ /**
15
+ * Largura da barra
16
+ */
17
+ barWidth?: number,
18
+ /**
19
+ * Tamanho da fonte da porcentagem
20
+ */
21
+ fontSize?: string,
22
+ /**
23
+ * Cor da fonte
24
+ */
25
+ color?: string,
26
+ /**
27
+ * Cor de fundo
28
+ */
29
+ backgroundColor?: string,
30
+ /**
31
+ * Cor da barra
32
+ */
33
+ barColor?: string,
34
+ /**
35
+ * Cor de fundo da barra
36
+ */
37
+ barBackgroundColor?: string
38
+ }
39
+
40
+ declare function PercentageDisplay(props: PercentageDisplayProps): JSX.Element
41
+
42
+ export default PercentageDisplay;
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ var core_1 = require("@material-ui/core");
23
+ var react_1 = __importStar(require("react"));
24
+ var useStyles = core_1.makeStyles({
25
+ container: {
26
+ display: 'grid',
27
+ placeItems: 'center'
28
+ },
29
+ circularProgress: {
30
+ height: function (_a) {
31
+ var size = _a.size;
32
+ return size;
33
+ },
34
+ width: function (_a) {
35
+ var size = _a.size;
36
+ return size;
37
+ },
38
+ backgroundColor: function (_a) {
39
+ var barBackgroundColor = _a.barBackgroundColor;
40
+ return barBackgroundColor;
41
+ },
42
+ borderRadius: '50%',
43
+ display: 'grid',
44
+ placeItems: 'center',
45
+ '&::before': {
46
+ content: '""',
47
+ position: 'absolute',
48
+ height: function (_a) {
49
+ var progressBarWidth = _a.progressBarWidth;
50
+ return progressBarWidth;
51
+ },
52
+ width: function (_a) {
53
+ var progressBarWidth = _a.progressBarWidth;
54
+ return progressBarWidth;
55
+ },
56
+ borderRadius: '50%',
57
+ backgroundColor: function (_a) {
58
+ var backgroundColor = _a.backgroundColor;
59
+ return backgroundColor;
60
+ }
61
+ }
62
+ },
63
+ valueContainer: {
64
+ position: 'relative',
65
+ color: function (_a) {
66
+ var color = _a.color;
67
+ return color;
68
+ },
69
+ fontSize: function (_a) {
70
+ var fontSize = _a.fontSize;
71
+ return fontSize;
72
+ }
73
+ }
74
+ });
75
+ var PercentageDisplay = function (_a) {
76
+ var id = _a.id, _b = _a.percentage, percentage = _b === void 0 ? 0 : _b, _c = _a.size, size = _c === void 0 ? 50 : _c, _d = _a.barWidth, barWidth = _d === void 0 ? 6 : _d, _e = _a.fontSize, fontSize = _e === void 0 ? '0.9rem' : _e, _f = _a.color, color = _f === void 0 ? '#000' : _f, _g = _a.backgroundColor, backgroundColor = _g === void 0 ? '#fff' : _g, _h = _a.barColor, barColor = _h === void 0 ? '#00995d' : _h, _j = _a.barBackgroundColor, barBackgroundColor = _j === void 0 ? '#00995d26' : _j;
77
+ var progressBarWidth = size - barWidth;
78
+ var classes = useStyles({ color: color, backgroundColor: backgroundColor, barColor: barColor, barBackgroundColor: barBackgroundColor, size: size, progressBarWidth: progressBarWidth, fontSize: fontSize });
79
+ var percentageDisplayProgressId = id + "-percentageDisplayProgress";
80
+ var createProgress = react_1.useCallback(function () {
81
+ var porcentagem = parseInt(percentage);
82
+ var progressBar = document.getElementById(percentageDisplayProgressId);
83
+ if (!progressBar)
84
+ return;
85
+ progressBar.style.background = "conic-gradient(" + barColor + " " + porcentagem * 3.6 + "deg, " + barBackgroundColor + " " + porcentagem * 3.6 + "deg)";
86
+ }, [barBackgroundColor, barColor, percentage, percentageDisplayProgressId]);
87
+ react_1.useEffect(function () { return createProgress(); }, [percentage, createProgress]);
88
+ return react_1.default.createElement("div", { className: classes.container },
89
+ react_1.default.createElement("div", { id: percentageDisplayProgressId, className: classes.circularProgress },
90
+ react_1.default.createElement("div", { className: classes.valueContainer }, percentage + "%")));
91
+ };
92
+ exports.default = PercentageDisplay;
@@ -0,0 +1,2 @@
1
+ export { default } from './PercentageDisplay';
2
+ export * from './PercentageDisplay';
@@ -0,0 +1,8 @@
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
+ exports.default = void 0;
7
+ var PercentageDisplay_1 = require("./PercentageDisplay");
8
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(PercentageDisplay_1).default; } });
package/lib/api/index.js CHANGED
@@ -416,11 +416,12 @@ export const scanDocument = async (idDocumento, nrRevisao) => {
416
416
  return await res.json();
417
417
  };
418
418
 
419
- export const getWidgets = async (tpSelecao) => {
419
+ export const getWidgets = async (tpSelecao, abortController) => {
420
420
  const res = await fetch(`${api()}agetwidgets.rslvr`, {
421
421
  method: 'post',
422
422
  headers: headers(),
423
- body: JSON.stringify({ tpSelecao })
423
+ body: JSON.stringify({ tpSelecao }),
424
+ signal: abortController?.signal
424
425
  });
425
426
  return await res.json();
426
427
  };
@@ -0,0 +1,42 @@
1
+ export interface PercentageDisplayProps {
2
+ /**
3
+ * Identificação do elemento
4
+ */
5
+ id?: string,
6
+ /**
7
+ * Porcentagem
8
+ */
9
+ percentage?: number|string,
10
+ /**
11
+ * Tamanho do componente
12
+ */
13
+ size?: number,
14
+ /**
15
+ * Largura da barra
16
+ */
17
+ barWidth?: number,
18
+ /**
19
+ * Tamanho da fonte da porcentagem
20
+ */
21
+ fontSize?: string,
22
+ /**
23
+ * Cor da fonte
24
+ */
25
+ color?: string,
26
+ /**
27
+ * Cor de fundo
28
+ */
29
+ backgroundColor?: string,
30
+ /**
31
+ * Cor da barra
32
+ */
33
+ barColor?: string,
34
+ /**
35
+ * Cor de fundo da barra
36
+ */
37
+ barBackgroundColor?: string
38
+ }
39
+
40
+ declare function PercentageDisplay(props: PercentageDisplayProps): JSX.Element
41
+
42
+ export default PercentageDisplay;
@@ -0,0 +1,65 @@
1
+ import { makeStyles } from '@material-ui/core';
2
+ import React, { useCallback, useEffect } from 'react';
3
+
4
+ const useStyles = makeStyles({
5
+ container: {
6
+ display: 'grid',
7
+ placeItems: 'center'
8
+ },
9
+ circularProgress: {
10
+ height: ({ size }) => size,
11
+ width: ({ size }) => size,
12
+ backgroundColor: ({ barBackgroundColor }) => barBackgroundColor,
13
+ borderRadius: '50%',
14
+ display: 'grid',
15
+ placeItems: 'center',
16
+ '&::before': {
17
+ content: '""',
18
+ position: 'absolute',
19
+ height: ({ progressBarWidth }) => progressBarWidth,
20
+ width: ({ progressBarWidth }) => progressBarWidth,
21
+ borderRadius: '50%',
22
+ backgroundColor: ({ backgroundColor }) => backgroundColor
23
+ }
24
+ },
25
+ valueContainer: {
26
+ position: 'relative',
27
+ color: ({ color }) => color,
28
+ fontSize: ({ fontSize }) => fontSize
29
+ }
30
+ });
31
+
32
+ const PercentageDisplay = ({
33
+ id,
34
+ percentage = 0,
35
+ size = 50,
36
+ barWidth = 6,
37
+ fontSize = '0.9rem',
38
+ color = '#000',
39
+ backgroundColor = '#fff',
40
+ barColor = '#00995d',
41
+ barBackgroundColor = '#00995d26'
42
+ }) => {
43
+
44
+ const progressBarWidth = size - barWidth;
45
+ const classes = useStyles({ color, backgroundColor, barColor, barBackgroundColor, size, progressBarWidth, fontSize });
46
+ const percentageDisplayProgressId = `${id}-percentageDisplayProgress`;
47
+
48
+ const createProgress = useCallback(() => {
49
+ const porcentagem = parseInt(percentage);
50
+ const progressBar = document.getElementById(percentageDisplayProgressId);
51
+ if (!progressBar) return;
52
+ progressBar.style.background = `conic-gradient(${barColor} ${porcentagem * 3.6}deg, ${barBackgroundColor} ${porcentagem * 3.6}deg)`;
53
+ }, [barBackgroundColor, barColor, percentage, percentageDisplayProgressId]);
54
+ useEffect(() => createProgress(), [percentage, createProgress]);
55
+
56
+ return <div className={classes.container}>
57
+ <div id={percentageDisplayProgressId} className={classes.circularProgress}>
58
+ <div className={classes.valueContainer}>
59
+ {`${percentage}%`}
60
+ </div>
61
+ </div>
62
+ </div>;
63
+ };
64
+
65
+ export default PercentageDisplay;
@@ -0,0 +1,2 @@
1
+ export { default } from './PercentageDisplay';
2
+ export * from './PercentageDisplay';
@@ -0,0 +1 @@
1
+ export { default } from './PercentageDisplay';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "argous",
3
- "version": "1.2.174",
3
+ "version": "1.2.176",
4
4
  "description": "Argous.",
5
5
  "main": "lib/index.js",
6
6
  "author": "Carlos Schneider",